Cannot display some local files with a space in their name
See original GitHub issueI’m loading images from the local storage using the following code:
if (file.exists() && ContentType.isImage(file)) {
final String uri = Uri.fromFile(file).toString();
ImageLoader.getInstance().displayImage(uri, imageView);
}
This fails with the following exception:
/storage/emulated/0/.../ad%20(1).jpg: open failed: ENOENT (No such file or directory)
java.io.FileNotFoundException: /storage/emulated/0/.../ad%20(1).jpg: open failed: ENOENT (No such file or directory)
// path manually truncated, due to length
It looks like the file name extracted from the URL does not decode the %20 to " ".
Issue Analytics
- State:
- Created 10 years ago
- Comments:10
Top Results From Across the Web
How to start/open a file/folder that contains space in its name ...
I'm trying to use the start command in the command prompt to open files and folders, but I'm unable to open files and...
Read more >Cannot link to local files with spaces in filename #2539 - GitHub
As a workaround, try escaping your spaces: [example](file\ with\ spaces.md) . This is non-standard and doesn't work on GitHub's markdown, but it ...
Read more >Naming Files, Paths, and Namespaces - Win32 apps
The backslash divides the file name from the path to it, and one directory name from another directory name in a path. You...
Read more >How do I specify C:\Program Files without a space in it for ...
User this command: mklink /D "C:\LinkToProgramFiles" "C:\Program Files". And then, you start using "C:\LinkToProgramFiles" in the applications that can't handle ...
Read more >530064 - Firefox can't open local files (from Finder) with space ...
Bingo! Its the space character in the file name! Take out the space and it opens OK. Put a space into a file...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hey, Just solved the issue. After getting uri using: Uri fileUri=Uri.fromfile(fileObject);
USE: setUrl(Uri.decode(fileUri));
Cheers!
I have same problem when path contains chinese.