Page 1 of 1

Execute plugin handling ampersands in torrent names: windows

Posted: Sat Aug 30, 2014 12:44 am
by TheShanMan
From what I can tell, the execute plugin doesn't properly escape ampersands ("&") found in a torrent name and therefore my batch file is failing. I checked the deluge log file to see if it could show exactly what the plugin is using as the command line but it doesn't (at least at default logging level).

Does the execute plugin escape the ampersand?

Is there a way to see exactly what command line is being used for a given torrent?

Re: Execute plugin handling ampersands in torrent names: win

Posted: Wed Nov 04, 2015 2:51 am
by TheShanMan
Wondering about this limitation again. I'm tempted to download source and attempt a fix. Could a fix potentially be committed into the source repository? Hoping to get tentative approval since that would help motivate me to go to the trouble.

Re: Execute plugin handling ampersands in torrent names: win

Posted: Wed Nov 04, 2015 11:31 am
by Cas
The torrent name is utf8 encoded, it is your script that needs to handle the filename correctly.

Re: Execute plugin handling ampersands in torrent names: win

Posted: Wed Nov 04, 2015 3:26 pm
by TheShanMan
No, I'm not talking about encoding. I'm talking about escaping.

Re: Execute plugin handling ampersands in torrent names: win

Posted: Thu Nov 05, 2015 3:48 pm
by TheShanMan
To expand on my prior post, I'm talking about escaping required by the Windows OS command line. Unless an ampersand is escaped, Windows interprets it as separating 2 commands, so it runs everything before the ampersand as one command and everything after it as another command (ref: http://www.robvanderwoude.com/condexec.php). So when the execute plugin tries to run a command and the filename has an ampersand in it, Windows tries to run it as 2 separate and partial commands.

I have tested my script by calling it manually, and if it is called with the ampersand properly escaped, my script works fine. So the problem isn't my script as you suggested. And it's not an encoding issue. It's a Windows-specific command line escaping issue with the plugin.

http://stackoverflow.com/questions/1402 ... -parameter

Re: Execute plugin handling ampersands in torrent names: win

Posted: Thu Nov 05, 2015 10:33 pm
by Cas
Ok that makes more sense now. It should be a case of double-quoting the parameters passed to getProcessOutputAndValue.

Re: Execute plugin handling ampersands in torrent names: win

Posted: Fri Nov 06, 2015 12:10 am
by TheShanMan
Cool. So then the question is how to move forward. Is that something you want to fix? If not, can I fix it and submit it for inclusion in future releases? I would prefer the former since I would have to ramp up on deluge development but if it'll only get done if I do it myself, I'm willing to give it a shot.

Re: Execute plugin handling ampersands in torrent names: win

Posted: Fri Nov 06, 2015 12:20 am
by Cas
I can fix it but it's not something I will be fixing in the immediate future, especially since it's a Windows issue. It's up to you but Deluge development is fun ;)

Ticket so it doesn't get forgotten about: http://dev.deluge-torrent.org/ticket/2784