Skip to content

Commit

Permalink
Remove port from JSLocation when returning packager host
Browse files Browse the repository at this point in the history
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
  • Loading branch information
jimmy623 authored and facebook-github-bot committed Aug 20, 2020
1 parent 1271462 commit 12543d5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions React/Base/RCTBundleURLProvider.mm
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,12 @@ + (BOOL)isPackagerRunning:(NSString *)host
- (NSString *)packagerServerHost
{
NSString *location = [self jsLocation];
if (location) {
NSInteger index = [location rangeOfString:@":"].location;
if (index != NSNotFound) {
location = [location substringToIndex:index];
}
}
#if RCT_DEV_MENU
if ([location length] && ![RCTBundleURLProvider isPackagerRunning:location]) {
location = nil;
Expand Down

0 comments on commit 12543d5

Please sign in to comment.