AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

how? stop cURL interpreting comma(,) in path/filename

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
BETLOG



Joined: 27 Nov 2006
Posts: 218
Location: Queensland, Australia

PostPosted: Thu May 17, 2007 4:02 am    Post subject: how? stop cURL interpreting comma(,) in path/filename Reply with quote

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.
Back to top
View user's profile Send private message
SHiLLySiT



Joined: 17 May 2007
Posts: 12

PostPosted: Thu May 17, 2007 4:10 am    Post subject: Reply with quote

Best option is to NOT use commas.
Back to top
View user's profile Send private message
Titan



Joined: 11 Aug 2004
Posts: 5068
Location: imaginationland

PostPosted: Thu May 17, 2007 6:07 am    Post subject: Reply with quote

If you're using Run you need to escape commas (`,).
_________________

RegExReplace("irc.freenode.net/ahk", "^(?=(.(?=[\0-r\[]*((?<=\.).))))(?:[c-\x73]{2,8}(\S))+((2)|\b[^\2-]){2}\D++$", "$u3$1$3$4$2")
Back to top
View user's profile Send private message Visit poster's website
BETLOG



Joined: 27 Nov 2006
Posts: 218
Location: Queensland, Australia

PostPosted: Thu May 17, 2007 9:33 am    Post subject: Reply with quote

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).
Back to top
View user's profile Send private message
PhiLho



Joined: 27 Dec 2005
Posts: 6721
Location: France (near Paris)

PostPosted: Thu May 17, 2007 1:04 pm    Post subject: Reply with quote

If it interprets commas in quoted filenames, it looks like a bug. Or a limitation, of cURL or of Windows way of handling parameters.
_________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")
Back to top
View user's profile Send private message Visit poster's website
BETLOG



Joined: 27 Nov 2006
Posts: 218
Location: Queensland, Australia

PostPosted: Thu May 17, 2007 1:16 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
PhiLho



Joined: 27 Dec 2005
Posts: 6721
Location: France (near Paris)

PostPosted: Thu May 17, 2007 1:53 pm    Post subject: Reply with quote

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...
_________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group