Description
If you upload a file using the attachments form, the uploaded file will have the absolute pathname if using Internet Explorer (tested with IE6). Firefox and Netscape have the expected behavior.
Steps to reproduce
Go to WikiSandBox
- Select "Attachments" from the "More Actions:" drop down.
- Browse and select file on desktop.
- Click upload
- File will have the absolute path name.
Example
There are a number attachments in WikiSandBox now that exhibit the behavior. See http://moinmoin.wikiwikiweb.de/WikiSandBox?action=AttachFile
Details
This Wiki
Workaround
Live with long filenames or teach users to either
- link first, attach second
- or use the rename field.
or best, avoid Internet Explorer, use Firefox.
Discussion
I wonder if we should fix this, for example, get the basename from the file when getting the form data. It should be very simple:
>>> def basename(path): ... return path.split('\\')[-1] ... >>> basename('c:\\b\c.jpg') 'c.jpg' >>> basename('c.jpg') 'c.jpg'
unless we may get a name with \ from another platform?
We can: I just uploaded a file from Mac OS X, named a\b\c.jpg.
Maybe enable this fix only for IE? not 100% safe but should be fine.
No, basename should be ok for anyone. You cannot use \ anyway in MoinMoin.
Plan
- Priority: low
Assigned to: ThomasWaldmann
- Status: fixed in moin--main--1.3--patch-858