• Do not register here on develop.twiki.org, login with your twiki.org account.
• Use View topic Item7848 for generic doc work for TWiki-6.1.1. Use View topic Item7851 for doc work on extensions that are not part of a release. More... Close
• Anything you create or change in standard webs (Main, TWiki, Sandbox etc) will be automatically reverted on every SVN update.
Does this site look broken?. Use the LitterTray web for test cases.

Item6854: Cannot add attachments with TWiki 5.1.1 and IE 8

Item Form Data

AppliesTo: Component: Priority: CurrentState: WaitingFor: TargetRelease ReleasedIn
Engine   Normal Closed   patch 5.1.2

Edit Form Data

Summary:
Reported By:
Codebase:
Applies To:
Component:
Priority:
Current State:
Waiting For:
Target Release:
Released In:
 

Detail

This has been reported: -- TWiki:Main/PeterThoeny - 2012-03-02

The problem is attachments cannot be added using Internet Explorer 8 and TWiki version 5.1.1. The failures are the same in TWiki-VM (as downloaded from the TWiki site) and RedHat (manual installation).

These are the steps I am following:

  1. Log on as a registered user
  2. Create a new topic
  3. Click on Attach.
  4. Browse for an attachment.
  5. Click Upload file.
  6. No warning or messages are issued and the browser returns back to the topic.
  7. Clicking on Attach does not show any attachments and nothing is uploaded to the server.
I have verified the ownership and group settings are correct for all of the twiki content.

The problem does not occur when a non-Internet Explorer browser is used.

An error is being issued in the RH flavor running apache as shown in error_log... upload: Use of uninitialized value in concatenation (.) or string at /var/www/twiki/lib/TWiki/UI/Upload.pm line 423.

The same error is issued in the VM flavor of TWiki at /var/log/httpd/error_log.

Debugging lib/TWiki/UI/Upload.pm shows the file list in $query->{uploads}{$_} (line 229) appears to be empty -- although I'm not a perl expert by any means.

-- TWiki:Main.RobertNelson - 2012-03-03

This problem can also be seen on the twiki.org web site.

-- TWiki:Main.RobertNelson - 2012-03-03

This problem also exists with Internet Explorer 9. I have tried a variety of settings in IE9 without any resolution.

I have verified that Firefox does not have this problem.

-- TWiki:Main.RobertNelson - 2012-03-03

I downgraded the TWiki to 5.0.2 and the problem no longer appeared. I made no other changes to the apache server. OS, or client. This is an issue with 5.1.1.

-- TWiki:Main.RobertNelson - 2012-03-04

Thanks for the additional info, Robert. I suspect this has to do with a Chrome-specific fix we did in Item6832 for TWiki-5.1.1:

--- TWiki-5.0.2/templates/attach.pattern.tmpl   2011-05-03 22:29:18.000000000 -0700
+++ TWiki-5.1.1/templates/attach.pattern.tmpl   2012-01-14 21:53:18.000000000 -0800
@@ -61,7 +61,7 @@
   var fileNo = $('input.upload').size();
   $(obj).hide();
   $(obj).parent().prepend('<input type="file" class="upload" name="filepath'+fileNo+'" value="" size="50" onchange="doIt(this, '+fm+');" />');
-  var v = obj.value;
+  var v = obj.value.replace( /.*[\/\\]/, "" );
   if(v != '') {
     $("div#files_list").append('<div>'+'<input type="image" src="%ICONURL{remove}%" width="12" height="12" border="0"  alt="Remove file" title="Remove file" value="" style="margin:-2px 0px 0px 0px; border:none; padding:0px; width:12px; height:12px; background-color:transparent;" /> '+v+'</div>').find("input").click(
       function(){

--- TWiki-5.0.2/lib/TWiki/UI/Upload.pm   2011-05-03 22:29:32.000000000 -0700
+++ TWiki-5.1.1/lib/TWiki/UI/Upload.pm   2012-01-14 21:53:40.000000000 -0800
@@ -226,6 +227,7 @@
     # below - @upload_objs are array of TWiki::Request::Upload objects
 
     my @fileNames = grep { defined $query->{uploads}{$_} }
+      map { s/.*[\/\\]//; $_ }
       map { $query->param("filepath$_") } ( '', 1 .. 9 );
     my @upload_objs = @{ $query->{uploads} }{@fileNames};
 

I found a Win-98 with IE8. Unfortunately I can't reproduce the issue on that machine. Could you test if adding these lines to your TWiki-5.0.2 introduce the issue?

-- TWiki:Main.PeterThoeny - 2012-03-04

I manually added the 5.1.1 changes in to 5.0.2 and sure enough now 5.0.2 shows exactly the same behavior in that attachments cannot be added and apache logs the concatenation error.

The funny thing is we have both IE and chrome users.

I believe this is now an Urgent issue (at least for our users).

How long before this issue can be addressed? We need to make a determination on our next steps.

-- TWiki:Main.RobertNelson - 2012-03-05

OK, so it is confirmed that the Chrome-specific fix Item6832 causes the issue on IE. Could you please try one or the other patch ( templates/attach.pattern.tmpl or lib/TWiki/UI/Upload.pm) so see which which one causes the issue?

I wish I had an environment where I can reproduce this, it is hard to debug without.

-- TWiki:Main.PeterThoeny - 2012-03-04

The problem is with Upload.pm. Can I put some debug statements around this section of code for you? I know enough perl to write to the warning log but the rest of the code looks greek to me so simply tell me what to add.

-- TWiki:Main.RobertNelson - 2012-03-06

I did some digging. Could you try the following: Remove the map from Upload.pm and add the $fname regex line in CGI.pm:

Index: lib/TWiki/Engine/CGI.pm
===================================================================
--- lib/TWiki/Engine/CGI.pm   (revision 22664)
+++ lib/TWiki/Engine/CGI.pm   (working copy)
@@ -172,6 +172,7 @@
     my %uploads;
     foreach my $key ( keys %{ $this->{uploads} } ) {
         my $fname = $this->{cgi}->param($key);
+        $fname =~ s/.*[\/\\]//; # cut file path
         $uploads{$fname} = new TWiki::Request::Upload(
             headers => $this->{cgi}->uploadInfo($fname),
             tmpname => $this->{cgi}->tmpFileName($fname),
Index: lib/TWiki/UI/Upload.pm
===================================================================
--- lib/TWiki/UI/Upload.pm   (revision 22664)
+++ lib/TWiki/UI/Upload.pm   (working copy)
@@ -227,7 +227,6 @@
     # below - @upload_objs are array of TWiki::Request::Upload objects
 
     my @fileNames = grep { defined $query->{uploads}{$_} }
-      map { s/.*[\/\\]//; $_ }
       map { $query->param("filepath$_") } ( '', 1 .. 9 );
     my @upload_objs = @{ $query->{uploads} }{@fileNames};

I tested this on FF. Could you test this on IE and Chrome?

-- TWiki:Main.PeterThoeny - 2012-03-06

It works on Chrome but not on IE.

-- TWiki:Main.RobertNelson - 2012-03-06

Is there anything else I can do to help debug this?

-- TWiki:Main.RobertNelson - 2012-03-07

We had the same experience with IE 6, 7 and 9. Made a downgrade to 5.0.2 which resolved the problem. Now we're missing the nice enhancements of 5.1.1, but exclusion of IE users isn't an option.

-- Twiki:Main.ErwinKnott - 2012-03-27

Is there someone working on the solution to this? Looks urgent!

-- TWiki:Main.MartyBurns - 2012-03-29

I have temporarily fixed this on my end by appliying the Upload.pm fix above and not the GCI.pm fix.

It would be nice if TWiki could take ownership of this and get a release to fix it.

-- TWiki:Main.RobertNelson - 2012-04-02

This change will break Chrome again. It needs to be debugged and fixed. I'll work on it.

-- TWiki:Main.PeterThoeny - 2012-04-02

Thanks Peter. FYI I've tried the fix to Upload.pm both Chrome and IE and it seems to work without needing to change CGI.pm... but there may be cornercases that I have not explored.

-- TWiki:Main.RobertNelson - 2012-04-02

Thanks for the feedback. I'll do additional testing.

-- TWiki:Main.PeterThoeny - 2012-04-02

I did additional testing on various machines (Win XP, Win 7, OS-X) and browsers (FF, IE7 IE8, Chrome), looks OK now.

Patch: (e.g. remove one line at line 230)

--- TWiki/UI/Upload.pm   (revision 22664)
+++ TWiki/UI/Upload.pm   (working copy)
@@ -227,7 +227,6 @@
     # below - @upload_objs are array of TWiki::Request::Upload objects
 
     my @fileNames = grep { defined $query->{uploads}{$_} }
-      map { s/.*[\/\\]//; $_ }
       map { $query->param("filepath$_") } ( '', 1 .. 9 );
     my @upload_objs = @{ $query->{uploads} }{@fileNames};

This is now in SVN trunk and TWiki-5.1 release.

-- TWiki:Main.PeterThoeny - 2012-04-03

Do not work in IE9, any suggestions?

-- TWiki:Main.PavlaNovotna - 2012-07-10

Pavla: Please open a new bug report and provide details on server OS, TWiki version, client OS, exact IE version, IE quirks mode yes/no.

-- TWiki:Main.PeterThoeny - 2012-07-11

Sorry, everything works fine now, the problem was that I wasnt logged in in IE9. wink

-- TWiki:Main.PavlaNovotna - 2012-07-12

I have TWiki 5.0.1 and have : $fname =~ s/.*[\/\\]//; # cut file path in CGI.pm and removed map { s/.*[\/\\]//; $_ } in Upload.pm

But have that "C:\fakepath\..." string on upload in IE8 and 9. Is it possible to remove it?

-- TWiki:Main.BostjanTovornik - 2012-10-18

Bostian, please open a new bug item and specify exact environment so that we can reproduce.

-- TWiki:Main.PeterThoeny - 2012-10-18

ItemTemplate
Summary Cannot add attachments with TWiki 5.1.1 and IE 8
ReportedBy TWiki:Main.PeterThoeny
Codebase ~twiki4, 5.1.1
SVN Range

AppliesTo Engine
Component

Priority Normal
CurrentState Closed
WaitingFor

Checkins TWikirev:22778 TWikirev:22779
TargetRelease patch
ReleasedIn 5.1.2
Edit | Attach | Watch | Print version | History: r31 < r30 < r29 < r28 < r27 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r31 - 2012-10-18 - PeterThoeny
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback