diff --git a/.changeset/proud-ants-protect.md b/.changeset/proud-ants-protect.md new file mode 100644 index 000000000..8f90a8107 --- /dev/null +++ b/.changeset/proud-ants-protect.md @@ -0,0 +1,5 @@ +--- +'@callstack/repack': patch +--- + +Fix url encoded twice issue on iOS side diff --git a/packages/repack/ios/ScriptConfig.mm b/packages/repack/ios/ScriptConfig.mm index 791ab02a3..5dd2e2db9 100644 --- a/packages/repack/ios/ScriptConfig.mm +++ b/packages/repack/ios/ScriptConfig.mm @@ -21,7 +21,9 @@ + (ScriptConfig *)fromConfig:(JS::NativeScriptManager::NormalizedScriptLocator & { NSDictionary *_Nullable headers = (NSDictionary *)config.headers(); NSURLComponents *urlComponents = [NSURLComponents componentsWithString:config.url()]; - urlComponents.query = config.query(); + if (config.query() != nil) { + urlComponents.percentEncodedQuery = config.query(); + } NSURL *url = urlComponents.URL; return [[ScriptConfig alloc] initWithScript:scriptId @@ -40,7 +42,9 @@ + (ScriptConfig *)fromConfig:(JS::NativeScriptManager::NormalizedScriptLocator & + (ScriptConfig *)fromConfig:(NSDictionary *)config withScriptId:(nonnull NSString *)scriptId { NSURLComponents *urlComponents = [NSURLComponents componentsWithString:config[@"url"]]; - urlComponents.query = config[@"query"]; + if (config[@"query"] != nil) { + urlComponents.percentEncodedQuery = config[@"query"]; + } NSURL *url = urlComponents.URL; return [[ScriptConfig alloc] initWithScript:scriptId