Patch Proposal: Patch to fix logical error in upload script which prevented MIME filename from being used.
Motivation
I tried to batch upload several PDFs to twiki in order to migrate our internal web to twiki.
Description
Fixes a logical typo which previously resulted in ignoring the supplied filename in mime-protocol
Documentation
Examples
$file="bla.pdf";
$url="http://where.my.bla.is/pdfs/";
$toweb="Main/AllPdfs"
curl $url$file | curl -F "noredirect=1" -F "hidefile=0" -F "createlink=1" -F "filecomment=$comment" -F filepath=\
@- -F "filename=$file" --user YourName:YourPass http://twiki.your.domain/twiki/bin/upload/$toweb
Implementation
nada, just a fix
--
PeterMarquardt - 12 Apr 2004
Discussion:
I looked it over, it's simple enough and looks right, so I've committed it to TWiki CVS. Should be in the next alpha drop; thanks for the bugfix. My only concern is that the upload script doesn't do any filtering on the filename besides removing path prefixes. I'm not sure if that's a legitimate concern, but it might be a good idea to sanitize the filename as well.
Also, a few notes in case you post future patches: please replace [description] with a short description of the patch; this should also go in the
TopicSummary below.
InterestedParties is there for people to register their interest in a topic; once you've put your name in a few places, clicking the star icon on the top link bar will list out the topics you've flagged, most recent change first. It should not contain anything but usernames. We also appreciate it if you sign the topic, so we can see who contributed the patch without looking at the attachments. I've added your signature above and adjusted this topic as per my recommendations; all I ask is that you try to follow these conventions if you ever have anything more to add. Thanks.
--
WalterMundt - 13 Apr 2004
Walter, I'm not sure how you managed that since the upload script was retired and replaced by the Upload.pm module. If you put the patch in Upload.pm I have to warn you
it is probably wrong. Use of $fileName and $filePath are exclusive - If you have a $fileName, you don't usually have a $filePath, and vice-versa. It should work for Peter's example, but I don't think it will work in the general case.
--
CrawfordCurrie - 13 Apr 2004
It did get manually merged into Upload.pm. Note that IIRC the code in the module already fills in either from the other before the point that was patched is reached. I haven't marked this topic as 100% in case there are problems and due to the filename-sanitization issue.
I don't think it's broken, but please speak up if you find that it is!
--
WalterMundt - 03 May 2004
I have been using this on a variety of installations for some time now, and it works. Any new problems should go through the bug cycle. I'm setting it to 100%.
--
CrawfordCurrie - 01 Jul 2004