Issue to show an image due to filename encoding

Viewed 15

I'm trying to show an image in an html file:

<img src="./uploads/avatars/avatar-14523.jpg?dateline=1116314889"/>

All the avatar files has been downloaded thru a self-made python web-scrapper script.

user@device:~$ ll "scrape/0/uploads/avatars/avatar-14523.jpg?dateline=1116314889"
-rw-rw-r-- 1 user user 8.9K Jun 17 14:54 'scrape/0/uploads/avatars/avatar-14523.jpg?dateline=1116314889'

According to ll, the file indeed does exist. However, in firefox, it won't show, and if I click on the broken image to open it in another tab, it does not exist:

Firefox can’t find the file at file:///home/user/scrape/0/uploads/avatars/avatar-14523.jpg?dateline=1116314889.

Now, if I replace the '?' in the url by '%3F', firefox will show the file correctly thru the direct link: file:///home/user/scrape/0/uploads/avatars/avatar-14523.jpg%3Fdateline=1116314889

If i rename the avatar files with '%3F' instead of their '?', the html pages still won't show them.

I have about 100000 html files (12GB), with a lot of <img/> to avatars, I'm not willing to parse all that and take the risk to break them to modify the src= for each avatar. I wish to rename the avatar files in a way that browsers would simply show them thru the original <img/> code.

Any idea?

0 Answers
Related