Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

Persist querystrings in mapbox:// resource urls to API requests - #6182

Merged
jfirebaugh merged 1 commit into
masterfrom
keep-queries
Sep 16, 2016
Merged

jfirebaugh merged 1 commit into
masterfrom
keep-queries

Conversation

@jakepruitt

Copy link
Copy Markdown

Carries over any query strings from mapbox://-prefixed styles urls, source urls and tile urls to the api.mapbox.com requests.

cc/ @mapsam @1ec5 @jfirebaugh @yhahn @GretaCB

@mention-bot

Copy link
Copy Markdown

@jakepruitt, thanks for your PR! By analyzing this pull request, we identified @jfirebaugh, @yhahn and @1ec5 to be potential reviewers.

Comment thread src/mbgl/util/mapbox.cpp Outdated

return baseURL + "v4/" + url.substr(protocol.length()) + ".json?access_token=" + accessToken + "&secure";
auto queryIdx = url.find("?");
std::string query = "";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Omit = "" -- it'll be initialized to an empty string automatically.

Comment thread src/mbgl/util/mapbox.cpp Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally if (!query.empty()) { is better practice since it is faster than query.size().

@springmeyer

Copy link
Copy Markdown
Contributor

Made a refactoring pass and rebased this /cc @jakepruitt. Ready for review by others, notably @jfirebaugh @1ec5

Comment thread src/mbgl/util/mapbox.cpp Outdated
namespace mapbox {

const std::string protocol = "mapbox://";
const std::size_t protocol_length = protocol.length();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Camel case please.

Carries over any query strings from mapbox://-prefixed styles urls,
source urls and tile urls to the api.mapbox.com requests.
@jfirebaugh
jfirebaugh merged commit d169ea5 into master Sep 16, 2016
@jfirebaugh
jfirebaugh deleted the keep-queries branch September 16, 2016 21:11
@mapsam

mapsam commented Sep 19, 2016

Copy link
Copy Markdown
Contributor

Thank you @jfirebaugh!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants