Skip to content

Commit

Permalink
Strip whitespace and newlines from access token and style URL
Browse files Browse the repository at this point in the history
Just in case browser weirdness or a tendency to triple-click-select is causing some cases of mapbox#2012.
  • Loading branch information
1ec5 committed Nov 3, 2015
1 parent a68a8a2 commit 2dffdf4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions platform/ios/MGLAccountManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ + (BOOL) mapboxMetricsEnabledSettingShownInApp {
}

+ (void) setAccessToken:(NSString *) accessToken {
accessToken = [accessToken stringByTrimmingCharactersInSet:
[NSCharacterSet whitespaceAndNewlineCharacterSet]];
if ( ! [accessToken length]) return;

[MGLAccountManager sharedManager].accessToken = accessToken;
Expand Down
2 changes: 2 additions & 0 deletions platform/ios/MGLMapView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -3303,6 +3303,8 @@ - (nullable NSString *)styleURL__

- (void)setStyleURL__:(nullable NSString *)URLString
{
URLString = [URLString stringByTrimmingCharactersInSet:
[NSCharacterSet whitespaceAndNewlineCharacterSet]];
NSURL *url = URLString.length ? [NSURL URLWithString:URLString] : nil;
if (URLString.length && !url)
{
Expand Down

0 comments on commit 2dffdf4

Please sign in to comment.