Skip to content
Browse files

Merge pull request #22 from Tyilo/patch-1

Files with commas, semicolons and double quotation marks
  • Loading branch information...
2 parents 7bc0781 + 40858c8 commit b806efab04463bc5c359c342c8cd5de4504f0795 @uams committed Aug 26, 2013
Showing with 3 additions and 1 deletion.
  1. +3 −1 geturl
View
4 geturl
@@ -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']

0 comments on commit b806efa

Please sign in to comment.
Something went wrong with that request. Please try again.