AutoHotkey Community

It is currently May 25th, 2012, 5:34 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: May 17th, 2007, 4:02 am 
Offline

Joined: November 27th, 2006, 7:41 am
Posts: 222
Location: Queensland, Australia
cURL question:
I am using cURL to send a filename, the path to which contains commas (,)
eg: x:\images\SomeActorName (Alias1, Alias2)\imagename.jpg
cURL internally interprets this comma as the delimiter between two filenames, but in this context it's only one file. So naturally the transfer, and any form <input>s after this field fail.

I have tried using --form-string instead of -F, but get the same results.
...but perhaps I don't understand the usage properly.

Is there a way to force cURL to disregard the comma in the path/filename? or should I just be avoiding commas in filenames at all cost?
(previously I had decided to avoid using hyphens (-) in filenames because of similar parsing error reasons... but comma and hyphen are unfortunately the best...most intuitive... characters to use for alias delimiters like this)

I also disabled 8.3 filenames in the registry, so using A_LoopFileShortName is not really an option.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 17th, 2007, 4:10 am 
Offline

Joined: May 17th, 2007, 3:10 am
Posts: 12
Best option is to NOT use commas.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 17th, 2007, 6:07 am 
Offline
User avatar

Joined: August 11th, 2004, 1:47 am
Posts: 5346
Location: UK
If you're using Run you need to escape commas (`,).

_________________
GitHubScriptsIronAHK Contact by email not private message.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 17th, 2007, 9:33 am 
Offline

Joined: November 27th, 2006, 7:41 am
Posts: 222
Location: Queensland, Australia
Titan, yeah I did that.
But it's cURL thats interpreting the comma, not ahk, so short of telling cURL to accept the string raw (which doesnt seem to be possible) i guess I'll just have to avoid commas in filenames (which is annoying, but easy).


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 17th, 2007, 1:04 pm 
Offline

Joined: December 27th, 2005, 1:46 pm
Posts: 6837
Location: France (near Paris)
If it interprets commas in quoted filenames, it looks like a bug. Or a limitation, of cURL or of Windows way of handling parameters.

_________________
Image vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 17th, 2007, 1:16 pm 
Offline

Joined: November 27th, 2006, 7:41 am
Posts: 222
Location: Queensland, Australia
I probably should have clarified earlier: cURL interprets commas as a delimeter between multiple filenames. So it's functioning correctly... it's just odd that there is no method (that i can see) of disabling it.
I guess the authors of cURL have never had to deal with files/paths containing commas.
cURL MANUAL file wrote:
1. Send multiple files in a single "field" with a single field name:
curl -F "pictures=@dog.gif,cat.gif"

I decided to just insert a message/abort to inform the user to rename the file before use. It's annoying, but is fine for now; I don't have a *lot* of files with commas in them.

Using --form-string doesn't seem to transfer the file properly, but I didn't experiment too much after i realised there would be very few files that caused a problem, and inserted the handler.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 17th, 2007, 1:53 pm 
Offline

Joined: December 27th, 2005, 1:46 pm
Posts: 6837
Location: France (near Paris)
Ah, indeed, if that's the format of the whole quoted field... Indeed, some characters are legal but should be avoided, like those used to separate files in PATH variable, and so on. It can be , or ; and so on.
Maybe you can detect the comma and automatically rename the file. You can even rename it back after uploading the file...

_________________
Image vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Cerberus, Google [Bot], patgenn123, poserpro, Sambo, tommy, Yahoo [Bot] and 25 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group