Hi.
Yesterday I uploaded an image and, unfortunately, I named it "Holsten_Lemon+.jpg". I completely forgot that '+' is a special character in URLs.
The upload went fine, and there was no error message, but when I was redirected to the Image page Image:Holsten_Lemon+.jpg, I got redirected to "Image:Holsten_Lemon_.jpg" (underscore instead of a plus). But the page says there is no file with this name, and the page title is "Image:Holsten Lemon .jpg" (space instead of a plus).
I can see the image correctly in the gallery of new files: http://disperso.net/Special:Newimages, and I can link to it too, but I can't see the the Image page in any way.
First: What should I do? I prefer to delete the file and upload it with a proper name, but I don't know how to do it. If I delete the file in the server, I suppose that some tables of the database have to be fixed, but I don't know which ones.
Second: It's a bug? I don't know if MediaWiki should allow upload a file with this name, but if it does, it should show it properly, isn't it?
Thanks in advance. Any suggestion is welcome.
Alejandro Exojo wrote:
Hi.
Yesterday I uploaded an image and, unfortunately, I named it "Holsten_Lemon+.jpg". I completely forgot that '+' is a special character in URLs.
The upload went fine, and there was no error message, but when I was redirected to the Image page Image:Holsten_Lemon+.jpg, I got redirected to "Image:Holsten_Lemon_.jpg" (underscore instead of a plus). But the page says there is no file with this name, and the page title is "Image:Holsten Lemon .jpg" (space instead of a plus).
Try going to /wiki/Image:Holsten_Lemon%2B.jpg
Second: It's a bug? I don't know if MediaWiki should allow upload a file with this name, but if it does, it should show it properly, isn't it?
If it allows the upload with that name and doesn't rewrite internal urls to acces there, it is.
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Alejandro Exojo wrote:
Yesterday I uploaded an image and, unfortunately, I named it "Holsten_Lemon+.jpg". I completely forgot that '+' is a special character in URLs.
'+' has been allowed in titles in the wiki since 1.8 (or earlier if you add it explicitly to $wgLegalTitleChars); as long as it's properly encoded everything works fine, just as it does for '&' and '?'.
It looks to me like you've got some bogus URL rewriting going on which is stripping the encoded '+'s (%2b), leaving them to be interpreted as spaces.
You should check if you have the same problem with ampersands or question marks (depending on how you do the rewrite).
First: What should I do? I prefer to delete the file and upload it with a proper name, but I don't know how to do it. If I delete the file in the server, I suppose that some tables of the database have to be fixed, but I don't know which ones.
DELETE FROM image WHERE img_name='Holsten_Lemon+.jpg';
- -- brion vibber (brion @ wikimedia.org)
El Lunes, 9 de Abril de 2007, Brion Vibber escribió:
Alejandro Exojo wrote:
Yesterday I uploaded an image and, unfortunately, I named it "Holsten_Lemon+.jpg". I completely forgot that '+' is a special character in URLs.
'+' has been allowed in titles in the wiki since 1.8 (or earlier if you add it explicitly to $wgLegalTitleChars); as long as it's properly encoded everything works fine, just as it does for '&' and '?'.
Oh, I didn't knew that. Thanks.
It looks to me like you've got some bogus URL rewriting going on which is stripping the encoded '+'s (%2b), leaving them to be interpreted as spaces.
You're right. I tried encoding the plus sign with %2B, as platonides suggests, but only in the URL that should be rewritten. If I go to index.php?title=Image:Holsten_Lemon%2B.jpg it works!
My rewriting is done with this:
RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /index.php?title=$1 [L,QSA]
I tried encoding '?', and it works, so I still have to investigate what's wrong, but at least I know where is the problem. :)
You should check if you have the same problem with ampersands or question marks (depending on how you do the rewrite).
First: What should I do? I prefer to delete the file and upload it with a proper name, but I don't know how to do it. If I delete the file in the server, I suppose that some tables of the database have to be fixed, but I don't know which ones.
DELETE FROM image WHERE img_name='Holsten_Lemon+.jpg';
And that's all? I did a search in a mysql dump, and it seems it appears also in the table 'page' and 'logging'. Can I ignore them?
Thanks again.
Alejandro Exojo wrote:
First: What should I do? I prefer to delete the file and upload it with a proper name, but I don't know how to do it. If I delete the file in the server, I suppose that some tables of the database have to be fixed, but I don't know which ones.
DELETE FROM image WHERE img_name='Holsten_Lemon+.jpg';
And that's all? I did a search in a mysql dump, and it seems it appears also in the table 'page' and 'logging'. Can I ignore them?
Thanks again.
The logging table says you uploaded taht file. That's not important, the software doesn't matter (humans may wonder why this uploaded file wasn't deleted and is not there). The entry on page is its article. It has independent existance without the file. As you can access via index.php?title=Image:Holsten_Lemon%2B.jpg you'll probably want to delete it via index.php?title=Image:Holsten_Lemon%2B.jpg&action=delete ...or keep it to know when the rewriting issue is solved.
Saludos
El Martes, 10 de Abril de 2007, Platonides escribió:
The logging table says you uploaded taht file. That's not important, the software doesn't matter (humans may wonder why this uploaded file wasn't deleted and is not there). The entry on page is its article. It has independent existance without the file. As you can access via index.php?title=Image:Holsten_Lemon%2B.jpg you'll probably want to delete it via index.php?title=Image:Holsten_Lemon%2B.jpg&action=delete ...or keep it to know when the rewriting issue is solved.
I finally did this: remove the file with the URL that doesn't need rewrite, so I don't have to play with the tables.
Thanks a lot for your help. :)
mediawiki-l@lists.wikimedia.org