wonday / react-native-pdf

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

Fix PDF failed to load when the file URI contains an encoded accented character #873

Closed bernhardoj closed 3 days ago

bernhardoj commented 1 month ago

The decoding of the URI is currently done using unescape. https://github.com/wonday/react-native-pdf/blob/d545ff27b49850c773f6c443dfc65891881c0ed2/index.js#L238

However, this fails if the URI contains an encoded accented name, for example:

ù is encoded to %C3%B9, but decoding it using unescape gives ù.

This PR replaces unescape with decodeURIComponent.

jjcoffee commented 1 month ago

Possibly related issue https://github.com/wonday/react-native-pdf/issues/697. Also note that unescape is deprecated.