Strip whitespace and newlines from access token and style URL

Just in case browser weirdness or a tendency to triple-click-select is causing some cases of #2012.
This commit is contained in:
Minh Nguyễn
2015-11-03 11:28:13 -08:00
parent 2b5b6fad96
commit 1e27092669
2 changed files with 4 additions and 0 deletions

View File

@@ -60,6 +60,8 @@
}
+ (void) setAccessToken:(NSString *) accessToken {
accessToken = [accessToken stringByTrimmingCharactersInSet:
[NSCharacterSet whitespaceAndNewlineCharacterSet]];
if ( ! [accessToken length]) return;
[MGLAccountManager sharedManager].accessToken = accessToken;

View File

@@ -3303,6 +3303,8 @@ class MBGLView : public mbgl::View
- (void)setStyleURL__:(nullable NSString *)URLString
{
URLString = [URLString stringByTrimmingCharactersInSet:
[NSCharacterSet whitespaceAndNewlineCharacterSet]];
NSURL *url = URLString.length ? [NSURL URLWithString:URLString] : nil;
if (URLString.length && !url)
{