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

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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