wonday / react-native-pdf

A <Pdf /> component for react-native
MIT License
1.6k stars 553 forks source link

Issue with spaces in file names #646

Closed barun1997 closed 2 years ago

barun1997 commented 2 years ago

What react-native version are you using? 0.68.0

What react-native-pdf version are you using? 6.5.0

What platform does your issue occur on? (android/ios/both) iOS

Describe your issue as precisely as possible :

1) Try previewing a PDF file with a space in the name

It returns load error

barun1997 commented 2 years ago

I am not familiar with Native code, but this is my diagnosis so far (with help from parasharrajat)

It seems that on Android, we parse the file path, however, on iOs returns a further encoded URI string which throws an error.

I checked what this line returns if it's given an encoded URI string of: ...Sample%20file.pdf and it is: ...Sample%2520file.pdf

This is the reason why for any file with a space in its name, the pdf ref is null.

dragoshuniq commented 2 years ago

I have the same problem on iOS, even if I get uri the file isn't displayed, just without spaces.

Drzaln commented 2 years ago

Is this duplicated? https://github.com/wonday/react-native-pdf/issues/488