diff options
-rw-r--r-- | src/mbgl/util/mapbox.cpp | 6 | ||||
-rw-r--r-- | test/miscellaneous/mapbox.cpp | 1 |
2 files changed, 6 insertions, 1 deletions
diff --git a/src/mbgl/util/mapbox.cpp b/src/mbgl/util/mapbox.cpp index a8da81d1fd..4b4f24e138 100644 --- a/src/mbgl/util/mapbox.cpp +++ b/src/mbgl/util/mapbox.cpp @@ -45,7 +45,11 @@ std::string normalizeGlyphsURL(const std::string& url, const std::string& access if (url.compare(0, mapbox.length(), mapbox) != 0) return url; - return normalizeURL(url, "/v4/", accessToken); + const std::string fontstack = "mapbox://fontstack/"; + if (url.compare(0, fontstack.length(), fontstack) == 0) + return normalizeURL(url, "/v4/", accessToken); + + return normalizeURL(url, "/", accessToken); } std::string normalizeTileURL(const std::string& url, const std::string& sourceURL, SourceType sourceType) { diff --git a/test/miscellaneous/mapbox.cpp b/test/miscellaneous/mapbox.cpp index 1aff2494a4..f93749760b 100644 --- a/test/miscellaneous/mapbox.cpp +++ b/test/miscellaneous/mapbox.cpp @@ -15,6 +15,7 @@ TEST(Mapbox, SourceURL) { TEST(Mapbox, GlyphsURL) { EXPECT_EQ(mbgl::util::mapbox::normalizeGlyphsURL("mapbox://fontstack/{fontstack}/{range}.pbf", "key"), "https://api.tiles.mapbox.com/v4/fontstack/{fontstack}/{range}.pbf?access_token=key"); + EXPECT_EQ(mbgl::util::mapbox::normalizeGlyphsURL("mapbox://fonts/v1/user/{fontstack}/{range}.pbf", "key"), "https://api.tiles.mapbox.com/fonts/v1/user/{fontstack}/{range}.pbf?access_token=key"); EXPECT_EQ(mbgl::util::mapbox::normalizeGlyphsURL("http://path", "key"), "http://path"); } |