From fd190b96106ca4916539d96ff6c4ecef7833f148 Mon Sep 17 00:00:00 2001 From: "Jason C. Leach" Date: Wed, 7 Jun 2023 14:15:03 -0700 Subject: [PATCH] fix: encode tails url (#1479) --- packages/react-native/src/ReactNativeFileSystem.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/react-native/src/ReactNativeFileSystem.ts b/packages/react-native/src/ReactNativeFileSystem.ts index a14ba4bd40..7c2b8b239c 100644 --- a/packages/react-native/src/ReactNativeFileSystem.ts +++ b/packages/react-native/src/ReactNativeFileSystem.ts @@ -66,8 +66,11 @@ export class ReactNativeFileSystem implements FileSystem { // Make sure parent directories exist await RNFS.mkdir(getDirFromFilePath(path)) + // Some characters in the URL might be invalid for + // the native os to handle. We need to encode the URL. + const encodedFromUrl = encodeURI(url) const { promise } = RNFS.downloadFile({ - fromUrl: url, + fromUrl: encodedFromUrl, toFile: path, })