summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMinh Nguyễn <mxn@1ec5.org>2015-11-03 11:28:13 -0800
committerMinh Nguyễn <mxn@1ec5.org>2015-11-03 14:46:30 -0800
commit1e2709266902c59bfdf1f708b20cb2e18d1d3b90 (patch)
tree23df359c8c8a7289fd97cf2e2089b95d561a7e6c
parent2b5b6fad96a38837da21300e8541a7c9a69c19a5 (diff)
downloadqtlocation-mapboxgl-1e2709266902c59bfdf1f708b20cb2e18d1d3b90.tar.gz
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.
-rw-r--r--platform/ios/MGLAccountManager.m2
-rw-r--r--platform/ios/MGLMapView.mm2
2 files changed, 4 insertions, 0 deletions
diff --git a/platform/ios/MGLAccountManager.m b/platform/ios/MGLAccountManager.m
index d8e445d5cc..f7b5290767 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 078841bbb0..54cc3e879f 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)
{