@@ -63,6 +63,25 @@ public interface IMapillaryUrls {
63
63
*/
64
64
String getAccessId ();
65
65
66
+ /**
67
+ * Get the access id in a URL safe manner (the http2 plugin doesn't like {@code "|"} characters)
68
+ *
69
+ * @return The access id
70
+ */
71
+ default String getUrlEncodedAccessId () {
72
+ final String originalAccessId = getAccessId ();
73
+ if (originalAccessId == null ) {
74
+ return null ;
75
+ }
76
+ try {
77
+ // Once we move to Java 10+, we can drop the name() and the catch
78
+ return URLEncoder .encode (originalAccessId , StandardCharsets .UTF_8 .name ());
79
+ } catch (UnsupportedEncodingException unsupportedEncodingException ) {
80
+ // We've hardcoded the UTF-8 charset, so this should never happen unless Java drops UTF_8.
81
+ throw new JosmRuntimeException (unsupportedEncodingException );
82
+ }
83
+ }
84
+
66
85
/**
67
86
* Get the client id
68
87
*
@@ -91,7 +110,7 @@ public interface IMapillaryUrls {
91
110
*/
92
111
default String getTrafficSigns () {
93
112
return MapillaryConfig .getUrls ().getBaseTileUrl () + "mly_map_feature_traffic_sign/2/{z}/{x}/{y}?access_token="
94
- + getAccessId ();
113
+ + getUrlEncodedAccessId ();
95
114
}
96
115
97
116
/**
@@ -101,7 +120,7 @@ default String getTrafficSigns() {
101
120
*/
102
121
default String getObjectDetections () {
103
122
return MapillaryConfig .getUrls ().getBaseTileUrl () + "mly_map_feature_point/2/{z}/{x}/{y}?access_token="
104
- + getAccessId ();
123
+ + getUrlEncodedAccessId ();
105
124
}
106
125
107
126
/**
@@ -124,9 +143,10 @@ default String getDetectionInformation(long image) {
124
143
default String getImages () {
125
144
if (Boolean .TRUE .equals (MapillaryProperties .USE_COMPUTED_LOCATIONS .get ())) {
126
145
return MapillaryConfig .getUrls ().getBaseTileUrl () + "mly1_computed_public/2/{z}/{x}/{y}?access_token="
127
- + getAccessId ();
146
+ + getUrlEncodedAccessId ();
128
147
}
129
- return MapillaryConfig .getUrls ().getBaseTileUrl () + "mly1_public/2/{z}/{x}/{y}?access_token=" + getAccessId ();
148
+ return MapillaryConfig .getUrls ().getBaseTileUrl () + "mly1_public/2/{z}/{x}/{y}?access_token="
149
+ + getUrlEncodedAccessId ();
130
150
}
131
151
132
152
/**
0 commit comments