Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Files with commas, semicolons and double quotation marks #22

Merged
merged 1 commit into from

2 participants

Asger Hautop Drewsen uams
Asger Hautop Drewsen

This escapes the filename passed to curl for uploading

Asger Hautop Drewsen Tyilo Files with commas, semicolons and double quotation marks
This escapes the filename passed to curl for uploading
40858c8
uams uams merged commit b806efa into from
Asger Hautop Drewsen Tyilo deleted the branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 1, 2013
  1. Asger Hautop Drewsen

    Files with commas, semicolons and double quotation marks

    Tyilo authored
    This escapes the filename passed to curl for uploading
This page is out of date. Refresh to see the latest.
Showing with 3 additions and 1 deletion.
  1. +3 −1 geturl
4 geturl
View
@@ -78,8 +78,10 @@ urls = []
print
for file in files:
print "Uploading %s to Filepicker.io..." % file
+
+ escapedname = '\\"%s\\"' % file.replace('"', '\\\\\\"')
output = check_output('curl --progress-bar -F "fileUpload=@%(filename)s" -F "apikey=%(apikey)s" %(fpurl)s/api/path/storage/%(fileurl)s' %
- {"filename": file, "apikey": APIKEY, "fpurl": FPURL, "fileurl": urllib.pathname2url(file)}, shell=True)
+ {"filename": escapedname, "apikey": APIKEY, "fpurl": FPURL, "fileurl": urllib.pathname2url(file)}, shell=True)
try:
data = json.loads(output)
url = data['data'][0]['url']
Something went wrong with that request. Please try again.