-
Notifications
You must be signed in to change notification settings - Fork 24.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ImageComponent - Characters truncated if image name contains '#' #37592
Comments
This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
Still not addressed. |
This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
Yes, this issue still persists. |
I'm taking a look at this and I was able to reproduce it. By debugging in Android, the URIs are not getting truncated either in the JS, C++ or Android side, they are going as-is to the request. See my screenshot below: This doesn't seem to be a problem with React Native/Fresco itself but with how the request URIs are interpreted, I found this answer which has some good links with references explaining the reasons behind it. It's good to mention that I tried to solve it by encoding part of the URI in the JS side, by doing I'm curious, what is your use case? maybe another solution would be to store the images with a different delimiter. |
Description
If a local image contains '#' in its name the file name will be truncated after the '#' e.g.:
/data/user/0/com.imagetest/files/invalid#ThisSeemsToBeTreatedAsACommentOuch.jpg
->/data/user/0/com.imagetest/files/invalid
. This will lead to React Native not finding the image on both android and iOS.I did some digging using the android debugger but did not find the exact location where the '#' is truncated. However I suspect it may be some C++/C code as it happens on both platforms. Maybe the issue even has something to do with https://github.com/facebook/fresco which came into picture while debugging and not react native itself. But I hope some of the maintainers can help me locate the issue.
React Native Version
0.71.8
Output of
npx react-native info
Steps to reproduce
Easiest way to reproduce this when using android:
uri
insource
of<Image ... />
When using iOS this is also an issue. To reproduce this you could download an image containing a '#' and display it using
<Image />
Snack, code example, screenshot, or link to a repository
App.tsx
:The example uses
react-native-fs
for accessing the DocumentDirectoryPath more comfortably. But the path could be set manually too.The two images
invalid#ThisSeemsToBeTreatedAsACommentOuch.jpg
as well asvalid&.jpg
must be placed in the apps DocumentDirectoryPath.The text was updated successfully, but these errors were encountered: