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

  1. Attach an image with extension .jpeg to page

  2. Enter GUI editor
  3. Click "Insert/Edit Image"
  4. specify attachment ???.jpeg

  5. click OK

Example

Component selection

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


CategoryMoinMoinBugFixed

MoinMoin: MoinMoinBugs/GuiEditorInsertImageWithJpegExtension (last edited 2008-08-07 22:26:48 by ReimarBauer)