Description
Inserting an image in the GUI editor with extension .jpeg fails with alert "Image Url must end with .gif, .png, .jpg or .jpeg".
Steps to reproduce
Attach an image with extension .jpeg to page
- Enter GUI editor
- Click "Insert/Edit Image"
specify attachment ???.jpeg
- click OK
Example
Component selection
- plugin moinimage
Details
MoinMoin Version |
1.5.8 |
OS and Version |
OpenBSD 4.2 |
Python Version |
2.4.4 |
Server Setup |
FastCGI |
Server Details |
Apache 1.3.29 |
Language you are using the wiki in (set in the browser/UserPreferences) |
en |
Workaround
This patch works for me, but I'm no J/S programmer.
--- htdocs/applets/moinFCKplugins/moinimage/fck_image.js.orig Thu Nov 29 15:35:25 2007 +++ htdocs/applets/moinFCKplugins/moinimage/fck_image.js Thu Nov 29 15:39:49 2007 @@ -134,7 +134,7 @@ { // Check for valid image Url var sEnd = sSrc.substring(sSrc.length-4, sSrc.length).toLowerCase(); - if (!(sEnd==".gif" || sEnd=='.png' || sEnd=='.jpg' || sEnd=='.jpeg')) + if (!(sEnd==".gif" || sEnd=='.png' || sEnd=='.jpg' || sSrc.substring(sSrc.length-5, sSrc.length).toLowerCase()=='.jpeg')) { alert("Image Url must end with .gif, .png, .jpg or .jpeg"); //XXX i18n! return false;
Discussion
It looks like you tried to use .JPEG or .Jpeg (but not .jpeg)? At least this is what your patch fixes (but for .jpeg only).
Not sure that case sensitivity is the issue here: the code above (pre patch) is comparing "jpeg" to ".jpeg" and this is always failing -- we're slicing out a 4 character string (4 max) and comparing it with a 5 character string.
Oops, sorry, looks like I have not read your patch exactly enough. Yes, you are right, thanks for the patch!
Plan
- Priority:
Assigned to: ThomasWaldmann
Status: fixed in 1.6 by http://hg.moinmo.in/moin/1.6/rev/5b2b7b119871 -- ReimarBauer 2008-08-07 22:26:48