Skip to content

Commit 12543d5

Browse files
jimmy623facebook-github-bot
authored andcommitted
Remove port from JSLocation when returning packager host
Summary: Changelog: Some callsites may rely on the assumption that address return by this method does not contain port information. JSLocation saved in NSUserDefault might contain port information, removing it here can prevent the issue for callsites. Differential Revision: D23240495 fbshipit-source-id: a2edf4abb086fd951dd089331407bd659aad1729
1 parent 1271462 commit 12543d5

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

React/Base/RCTBundleURLProvider.mm

+6
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,12 @@ + (BOOL)isPackagerRunning:(NSString *)host
125125
- (NSString *)packagerServerHost
126126
{
127127
NSString *location = [self jsLocation];
128+
if (location) {
129+
NSInteger index = [location rangeOfString:@":"].location;
130+
if (index != NSNotFound) {
131+
location = [location substringToIndex:index];
132+
}
133+
}
128134
#if RCT_DEV_MENU
129135
if ([location length] && ![RCTBundleURLProvider isPackagerRunning:location]) {
130136
location = nil;

0 commit comments

Comments
 (0)