From 1e2709266902c59bfdf1f708b20cb2e18d1d3b90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguy=E1=BB=85n?= Date: Tue, 3 Nov 2015 11:28:13 -0800 Subject: [PATCH] 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. --- platform/ios/MGLAccountManager.m | 2 ++ platform/ios/MGLMapView.mm | 2 ++ 2 files changed, 4 insertions(+) diff --git a/platform/ios/MGLAccountManager.m b/platform/ios/MGLAccountManager.m index d8e445d5c..f7b529076 100644 --- a/platform/ios/MGLAccountManager.m +++ b/platform/ios/MGLAccountManager.m @@ -60,6 +60,8 @@ } + (void) setAccessToken:(NSString *) accessToken { + accessToken = [accessToken stringByTrimmingCharactersInSet: + [NSCharacterSet whitespaceAndNewlineCharacterSet]]; if ( ! [accessToken length]) return; [MGLAccountManager sharedManager].accessToken = accessToken; diff --git a/platform/ios/MGLMapView.mm b/platform/ios/MGLMapView.mm index 078841bbb..54cc3e879 100644 --- a/platform/ios/MGLMapView.mm +++ b/platform/ios/MGLMapView.mm @@ -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) {