File tree 3 files changed +13
-6
lines changed
3 files changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -89,7 +89,14 @@ + (NSURL *)NSURL:(id)json
89
89
90
90
// Check if it has a scheme
91
91
if ([path rangeOfString: @" :" ].location != NSNotFound ) {
92
- path = [path stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding];
92
+ NSMutableCharacterSet *urlAllowedCharacterSet = [NSMutableCharacterSet new ];
93
+ [urlAllowedCharacterSet formUnionWithCharacterSet: [NSCharacterSet URLUserAllowedCharacterSet ]];
94
+ [urlAllowedCharacterSet formUnionWithCharacterSet: [NSCharacterSet URLPasswordAllowedCharacterSet ]];
95
+ [urlAllowedCharacterSet formUnionWithCharacterSet: [NSCharacterSet URLHostAllowedCharacterSet ]];
96
+ [urlAllowedCharacterSet formUnionWithCharacterSet: [NSCharacterSet URLPathAllowedCharacterSet ]];
97
+ [urlAllowedCharacterSet formUnionWithCharacterSet: [NSCharacterSet URLQueryAllowedCharacterSet ]];
98
+ [urlAllowedCharacterSet formUnionWithCharacterSet: [NSCharacterSet URLFragmentAllowedCharacterSet ]];
99
+ path = [path stringByAddingPercentEncodingWithAllowedCharacters: urlAllowedCharacterSet];
93
100
URL = [NSURL URLWithString: path];
94
101
if (URL) {
95
102
return URL;
Original file line number Diff line number Diff line change 33
33
static NSURL *getInspectorDeviceUrl (NSURL *bundleURL)
34
34
{
35
35
NSNumber *inspectorProxyPort = @8082 ;
36
- NSString *escapedDeviceName = [[[UIDevice currentDevice ] name ] stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding ];
37
- NSString *escapedAppName = [[[NSBundle mainBundle ] bundleIdentifier ] stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding ];
36
+ NSString *escapedDeviceName = [[[UIDevice currentDevice ] name ] stringByAddingPercentEncodingWithAllowedCharacters: NSCharacterSet .URLQueryAllowedCharacterSet ];
37
+ NSString *escapedAppName = [[[NSBundle mainBundle ] bundleIdentifier ] stringByAddingPercentEncodingWithAllowedCharacters: NSCharacterSet .URLQueryAllowedCharacterSet ];
38
38
return [NSURL URLWithString: [NSString stringWithFormat: @" http://%@ /inspector/device?name=%@ &app=%@ " ,
39
39
getServerHost (bundleURL, inspectorProxyPort),
40
40
escapedDeviceName,
44
44
static NSURL *getAttachDeviceUrl (NSURL *bundleURL, NSString *title)
45
45
{
46
46
NSNumber *metroBundlerPort = @8081 ;
47
- NSString *escapedDeviceName = [[[UIDevice currentDevice ] name ] stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding ];
48
- NSString *escapedAppName = [[[NSBundle mainBundle ] bundleIdentifier ] stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding ];
47
+ NSString *escapedDeviceName = [[[UIDevice currentDevice ] name ] stringByAddingPercentEncodingWithAllowedCharacters: NSCharacterSet .URLHostAllowedCharacterSet ];
48
+ NSString *escapedAppName = [[[NSBundle mainBundle ] bundleIdentifier ] stringByAddingPercentEncodingWithAllowedCharacters: NSCharacterSet .URLHostAllowedCharacterSet ];
49
49
return [NSURL URLWithString: [NSString stringWithFormat: @" http://%@ /attach-debugger-nuclide?title=%@ &device=%@ &app=%@ " ,
50
50
getServerHost (bundleURL, metroBundlerPort),
51
51
title,
Original file line number Diff line number Diff line change @@ -247,7 +247,7 @@ - (BOOL)webView:(__unused UIWebView *)webView shouldStartLoadWithRequest:(NSURLR
247
247
if (isJSNavigation && [request.URL.host isEqualToString: kPostMessageHost ]) {
248
248
NSString *data = request.URL .query ;
249
249
data = [data stringByReplacingOccurrencesOfString: @" +" withString: @" " ];
250
- data = [data stringByReplacingPercentEscapesUsingEncoding: NSUTF8StringEncoding ];
250
+ data = [data stringByAddingPercentEncodingWithAllowedCharacters: NSCharacterSet .URLQueryAllowedCharacterSet ];
251
251
252
252
NSMutableDictionary <NSString *, id > *event = [self baseEvent ];
253
253
[event addEntriesFromDictionary: @{
You can’t perform that action at this time.
0 commit comments