create new tag
, view all tags

Patch Proposal: Patch to fix logical error in upload script which prevented MIME filename from being used.


I tried to batch upload several PDFs to twiki in order to migrate our internal web to twiki.


Fixes a logical typo which previously resulted in ignoring the supplied filename in mime-protocol



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


nada, just a fix

-- PeterMarquardt - 12 Apr 2004


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

Topic attachments
I Attachment History Action Size Date Who Comment
Unknown file formatpatch upload.patch r1 manage 0.6 K 2004-04-13 - 07:02 PeterMarquardt patch bin/upload to enable curls filename parameters
Edit | Attach | Watch | Print version | History: r7 < r6 < r5 < r4 < r3 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r7 - 2004-07-01 - CrawfordCurrie
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2018 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.