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

Strip whitespace and newlines from access token and style URL #2912

Conversation

1ec5
Copy link
Contributor

@1ec5 1ec5 commented Nov 3, 2015

Just in case browser weirdness or a tendency to triple-click-select is causing some cases of #2012.

Ordinarily we’d want this kind of logic down in mbgl, but I think it belongs up here too because:

  • The access token is stored as an instance variable of MGLAccountManager, and I think that ivar should have the correct value too.
  • The inspectable style URL string gets transformed into an NSURL in -[MGLMapView setStyleURL__:]. NSURL demands RFC 1738/2732 well-formedness, so if the string has leading whitespace, the transformation will fail and you’ll wind up w/ no URL (and the default style).

/cc @friedbunny

@1ec5 1ec5 added the iOS Mapbox Maps SDK for iOS label Nov 3, 2015
@1ec5 1ec5 self-assigned this Nov 3, 2015
@1ec5 1ec5 added this to the ios-v3.0.0 milestone Nov 3, 2015
@friedbunny
Copy link
Contributor

Very prudent, thanks for the placement explanation. ❤️

@ljbade
Copy link
Contributor

ljbade commented Nov 3, 2015

@1ec5 Can you open similar for Android?

Also does this detect too-short access keys? A person in #2012 mentioned that happened to them.

@1ec5
Copy link
Contributor Author

1ec5 commented Nov 3, 2015

Also does this detect too-short access keys? A person in #2012 mentioned that happened to them.

No, and I think any stricter validation belongs in mbgl proper. This PR is only about URL well-formedness.

@1ec5
Copy link
Contributor Author

1ec5 commented Nov 3, 2015

The Bitrise test failure is being tracked as #2920. It’s unrelated to this change; merging.

Just in case browser weirdness or a tendency to triple-click-select is causing some cases of #2012.
@1ec5 1ec5 force-pushed the 1ec5-                                -2012 branch from 71d6ae2 to 1e27092 Compare November 3, 2015 22:46
@1ec5 1ec5 merged commit 1e27092 into master Nov 3, 2015
@1ec5 1ec5 removed the in progress label Nov 3, 2015
@1ec5 1ec5 deleted the 1ec5-                                -2012 branch November 3, 2015 23:04
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
iOS Mapbox Maps SDK for iOS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants