Passed variable (e.g., %1) are now quoted?

Report & discuss bugs found in SABnzbd
Forum rules
Help us help you:
  • Are you using the latest stable version of SABnzbd? Downloads page.
  • Tell us what system you run SABnzbd on.
  • Adhere to the forum rules.
  • Do you experience problems during downloading?
    Check your connection in Status and Interface settings window.
    Use Test Server in Config > Servers.
    We will probably ask you to do a test using only basic settings.
  • Do you experience problems during repair or unpacking?
    Enable +Debug logging in the Status and Interface settings window and share the relevant parts of the log here using [ code ] sections.
Post Reply
User avatar
SizzlechestSA
Newbie
Newbie
Posts: 5
Joined: October 9th, 2008, 3:30 pm

Passed variable (e.g., %1) are now quoted?

Post by SizzlechestSA »

I made a post-processing script a while back that uses %1.  I noticed ever since I upgraded to 0.4.5 that the variable passes the directory with quotes around it.  This breaks the script.  Is it possible to turn this off?  The scripts should be handling the quoting.
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: Passed variable (e.g., %1) are now quoted?

Post by shypike »

What was the previous release you used?
User avatar
SizzlechestSA
Newbie
Newbie
Posts: 5
Joined: October 9th, 2008, 3:30 pm

Re: Passed variable (e.g., %1) are now quoted?

Post by SizzlechestSA »

shypike wrote: What was the previous release you used?
0.4.4
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: Passed variable (e.g., %1) are now quoted?

Post by shypike »

There's no difference between 0.4.4 and 0.4.5 in this area.

Both versions put quotes around parameters that contain spaces, but
omit the quotes when no spaces are present.
This is standard behaviour of Windows + Python-libraries.

You can safely assume that you never need to put quotes around %x.

For Posix systems (Unix, Linux and OSX), the quotes are not present.
User avatar
SizzlechestSA
Newbie
Newbie
Posts: 5
Joined: October 9th, 2008, 3:30 pm

Re: Passed variable (e.g., %1) are now quoted?

Post by SizzlechestSA »

The problem with this is if you're writing a script that takes the variable and appends subfolders and/or filenames with spaces, it's not going to work.

I understand the quotes are not being put there by sabnzbd.  However, I think it would be a good idea to strip them (if they exist) before the variables are passed to the command line.  s/^"(.*)"$/\1/
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: Passed variable (e.g., %1) are now quoted?

Post by shypike »

We cannot strip them.
The problem with this is if you're writing a script that takes the variable and appends subfolders and/or filenames with spaces, it's not going to work.
Not true, try this in command prompt:

mkdir d:"with spaces"
mkdir d:"with spaces"\hello

Works fine.
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: Passed variable (e.g., %1) are now quoted?

Post by shypike »

Best trick to get rid of the quotes:

Code: Select all

set name=%1
set name=%name:"=%
doubledrat
Release Testers
Release Testers
Posts: 180
Joined: February 20th, 2008, 3:16 pm

Re: Passed variable (e.g., %1) are now quoted?

Post by doubledrat »

to be clear, windows NEEDS the quotes on the command line, otherwise e.g. param 1 could become params 1,2,3,4 and 5 - it would be impossible to sort out.  This is not the fault of sabnzbd.

I can't remember an example, but you can sometimes get into trouble when you have multiple sets of quotes on some windows commands, so stripping the "" is by far the safest route to take.
Post Reply