Changeset 5444 in josm


Ignore:
Timestamp:
2012-08-15T14:39:27+02:00 (12 years ago)
Author:
Don-vip
Message:

fix #7964 - remotecontrol imagery name encoding

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/ImageryHandler.java

    r5085 r5444  
    1313import org.openstreetmap.josm.io.remotecontrol.PermissionPrefWithDefault;
    1414
     15/**
     16 * Adds an imagery (WMS/TMS) layer. For instance, {@code /imagery?title=...&type=...&url=...}.
     17 * @since 3715
     18 */
    1519public class ImageryHandler extends RequestHandler {
    1620
     21    /**
     22     * The remote control command name used to add an imagery layer.
     23     */
    1724    public static final String command = "imagery";
    1825
     
    5663            String query = request.substring(request.indexOf('?') + 1);
    5764            if (query.indexOf("url=") == 0) {
    58                 args.put("url", decodeURL(query.substring(4)));
     65                args.put("url", decodeParam(query.substring(4)));
    5966            } else {
    6067                int urlIdx = query.indexOf("&url=");
    6168                if (urlIdx != -1) {
    62                     String url = query.substring(urlIdx + 1);
    63                     args.put("url", decodeURL(query.substring(urlIdx + 5)));
     69                    args.put("url", decodeParam(query.substring(urlIdx + 5)));
    6470                    query = query.substring(0, urlIdx);
    6571                } else {
     
    7278                    int eq = param.indexOf('=');
    7379                    if (eq != -1) {
    74                         args.put(param.substring(0, eq), param.substring(eq + 1));
     80                        args.put(param.substring(0, eq), decodeParam(param.substring(eq + 1)));
    7581                    }
    7682                }
     
    8086    }
    8187
    82     private String decodeURL(String url) {
     88    private String decodeParam(String param) {
    8389        try {
    84             return URLDecoder.decode(url, "UTF-8");
     90            return URLDecoder.decode(param, "UTF-8");
    8591        } catch (UnsupportedEncodingException e) {
    8692            throw new RuntimeException();
Note: See TracChangeset for help on using the changeset viewer.