Bug: Attached images are mangled
PNG and JPG images (maybe other formats too) are mangled on upload. BMP works okay.
| source file |
32,703 |
vtp.png |
c:\temp\ |
| destination |
32,810 |
vtp.png |
{file system path}/pub/Test/AttachTest/ |
| |
33,120 |
vtp.png,v |
|
Test case
- Create new topic, save
- Attach a PNG image (the image attached to this topic is the same one I used on my system)
- there is no error message from Twiki or Apache at this point.
- The inline image on the page shows as a broken [x]
- clicking on the attachment link at the end of the page (... /bin/viewfile/Test/AttachTest?rev=1.1&filename=vtp.png) also shows a broken image.
- this error message now appears in the Apache log:
[Thu Nov 22 17:35:49 2001] [error] [client 199.247.173.75] File does not exist:
/www/rr/pub/TWiki/TWikiPreferences/$name
[Thu Nov 22 17:42:58 2001] viewfile: Scalar value @types[0] better written as $t
ypes[0] at /www/rr/bin/viewfile line 39.
- if I manually copy and overwrite the image in pub/Test/AttachTest/ with the one from my local drive everything appears as it should and no further messages appear in the apache log.
- image from my local filesystem:
- image from within twiki, after upload:
Environment
--
MattWilkie - 22 Nov 2001
Fix record
Not sure what went wrong. Note the sligtly increased file size. Sounds like a \n to \r\n conversion problem (aka setup problem) on the NT server.
--
PeterThoeny - 23 Nov 2001
Why would it occur to PNG and JPG and not BMP?
How would I determine if \n->\r\n conversion is the problem? I used to have the
WhyDoLinesComeOutDoubleSpaced when editing problem but that went away when I mounted the drive in binary mode.
update: Verified that it is an \n->\r\n problem. If I attach a DOS text file the lines become doublespaced.
So in Cygwin mounting the drive in binary mode solves the
editing 2x-space problem but does not solve the
attach 2x-space problem.
--
MattWilkie - 23 Nov 2001
Not sure where the bug comes into play, TWiki only does a copy of the temp file supplied by the
CGI library. Copy is based on the File::Copy library. Could you try and upgrade the
CGI library? Try also with a different client OS and browser.
The error log you mention has nothing to do with this, see
NameNotFound.
--
PeterThoeny - 02 Dec 2001
cpan reported that File::Copy is up to date but
CGI was not (was v2.752, is now
v2.78). I upgraded
CGI and have now successfully uploaded PNG images. Thank you.
However, I have now either discovered a new bug or something is misconfigured: I cannot attach a second file to a topic which already has an attachment.
[Tue Dec 4 12:47:00 2001] upload: Can't create file /www/rr/data/Test/TestTopic6.txt
[Tue Dec 4 12:47:00 2001] upload: print() on closed filehandle TWiki::Store::FILE at ../lib/TWiki/Store.pm line 1163.
I am researching this right now and will come back with more details later.
later: this is not (merely) an attach bug, the topic.txt file is getting set read only, at which point edits fail as well (same error message in the apache log).
At the same time I have been troubleshooting this mangling problem I have been working on CygwinAuthentication with ntsec as well as upgrading to TWiki20011201beta.zip. Some wires may well be crossed now. I will attempt to back out some of the changes to produce a proper bug report.
later still: the locking problem went away after applying the steps 1-3 described by Colas in
RcsNonStrictLocking. So now I have problem free uploads and problem free editing. The only significant issue left now is
AuthenticationProblem
later yet: Basic Authentication is now working, but it's a kludge.
--
MattWilkie - 04 Dec 2001