UseModWiki | WikiBugs | RecentChanges | Preferences

Confirmed bug, fix below will be in the next release. Fixed in 1.0.1 --MarkusLude

I just downloaded and installed usemodwiki 1.0 and tried the file upload feature:

I uploaded an jpg-image for testing and it arrived damage. A quick check showed that every hex 0A in the file was converted to 0D 0A during the wiki upload process.

I guess you use some text file routine to write the data and since my system is IIS on windows perl converts to the windows line feed.

Another interesting thing is the wiki.pl needs write access to the directory it's running in to upload a file, I found it strange it does not use the temp directory or the new upload dir.


This is a bug. To fix it, change the code (near the end of the wiki.pl file):

  open UPLOADFILE, ">$UploadDir$filename";
  while (<$uploadFilehandle>) { print UPLOADFILE; }


  open UPLOADFILE, ">$UploadDir$filename";
  binmode UPLOADFILE;
  binmode $uploadFilehandle;
  while (<$uploadFilehandle>) { print UPLOADFILE; }
[Add the two lines that begin with "binmode".]

...which has been tested and found to work under Windows. (This fix should not affect other systems.) For the write access issue, that is a function of the CGI.pm code, not the wiki specific code (which writes only to the destination file). --CliffordAdams

Just tested, with this fix the file upload does work like I think it should (files are not mangled anymore). Thanks a lot!

I had the same problem (see UserHelp), and found the solution in the Perl FAQs for Windows. However, I only added the first binmode call. Therefore, shouldn't the second call to binmode be removed? Anyway, it works fine now. --OnnoBroekmans

I agree - only the first binmode call is needed. --DougConley

UseModWiki | WikiBugs | RecentChanges | Preferences
Edit text of this page | View other revisions | Search MetaWiki
Last edited October 17, 2007 4:10 pm by MarkusLude (diff)