Execute plugin handling ampersands in torrent names: windows

Suggest, post, or discuss plugins for Deluge
TheShanMan
Member
Member
Posts: 42
Joined: Sun Jun 23, 2013 4:16 pm
OS or Distro: Windows

Execute plugin handling ampersands in torrent names: windows

Postby TheShanMan » Sat Aug 30, 2014 12:44 am

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?

TheShanMan
Member
Member
Posts: 42
Joined: Sun Jun 23, 2013 4:16 pm
OS or Distro: Windows

Re: Execute plugin handling ampersands in torrent names: win

Postby TheShanMan » Wed Nov 04, 2015 2:51 am

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.

Cas
Top Bloke
Top Bloke
Posts: 3557
Joined: Mon Dec 07, 2009 6:04 am
OS or Distro: Ubuntu 16.04
Location: Scotland

Re: Execute plugin handling ampersands in torrent names: win

Postby Cas » Wed Nov 04, 2015 11:31 am

The torrent name is utf8 encoded, it is your script that needs to handle the filename correctly.

TheShanMan
Member
Member
Posts: 42
Joined: Sun Jun 23, 2013 4:16 pm
OS or Distro: Windows

Re: Execute plugin handling ampersands in torrent names: win

Postby TheShanMan » Wed Nov 04, 2015 3:26 pm

No, I'm not talking about encoding. I'm talking about escaping.

TheShanMan
Member
Member
Posts: 42
Joined: Sun Jun 23, 2013 4:16 pm
OS or Distro: Windows

Re: Execute plugin handling ampersands in torrent names: win

Postby TheShanMan » Thu Nov 05, 2015 3:48 pm

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

Cas
Top Bloke
Top Bloke
Posts: 3557
Joined: Mon Dec 07, 2009 6:04 am
OS or Distro: Ubuntu 16.04
Location: Scotland

Re: Execute plugin handling ampersands in torrent names: win

Postby Cas » Thu Nov 05, 2015 10:33 pm

Ok that makes more sense now. It should be a case of double-quoting the parameters passed to getProcessOutputAndValue.

TheShanMan
Member
Member
Posts: 42
Joined: Sun Jun 23, 2013 4:16 pm
OS or Distro: Windows

Re: Execute plugin handling ampersands in torrent names: win

Postby TheShanMan » Fri Nov 06, 2015 12:10 am

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.

Cas
Top Bloke
Top Bloke
Posts: 3557
Joined: Mon Dec 07, 2009 6:04 am
OS or Distro: Ubuntu 16.04
Location: Scotland

Re: Execute plugin handling ampersands in torrent names: win

Postby Cas » Fri Nov 06, 2015 12:20 am

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


Return to “Plugins”

Who is online

Users browsing this forum: No registered users and 4 guests