From 9df79e7e96322fafad5919551d9ab2ce5d48c5be Mon Sep 17 00:00:00 2001 From: Paco Estevez Garcia Date: Tue, 18 Jul 2017 10:51:47 -0700 Subject: [PATCH] Inspector crashes when a device name contained spaces Reviewed By: Hypuk Differential Revision: D5434498 fbshipit-source-id: f758497ca50e4c02e436812725acfe0dcb8428b4 --- React/DevSupport/RCTInspectorDevServerHelper.mm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/React/DevSupport/RCTInspectorDevServerHelper.mm b/React/DevSupport/RCTInspectorDevServerHelper.mm index f0033a6a9..54429bf39 100644 --- a/React/DevSupport/RCTInspectorDevServerHelper.mm +++ b/React/DevSupport/RCTInspectorDevServerHelper.mm @@ -30,9 +30,10 @@ static NSString *getDebugServerHost(NSURL *bundleURL) static NSURL *getInspectorDeviceUrl(NSURL *bundleURL) { + NSString *escapedText = [[[UIDevice currentDevice] name] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; return [NSURL URLWithString:[NSString stringWithFormat:@"http://%@/inspector/device?name=%@", getDebugServerHost(bundleURL), - [[UIDevice currentDevice] name]]]; + escapedText]]; }