Opened 18 months ago

Closed 8 months ago

Last modified 8 months ago

#2815 closed bug (Fixed)

Path inconsistency while escaping whitespace

Reported by: Joe96 Owned by: Cas
Priority: minor Milestone: 1.3.13
Component: Console UI Version: 1.3.12
Keywords: Cc:

Description

While adding a torrent using a command similar to this:

deluge-console add -p 'C:\Path\With Spaces' D:\my_torrent_file.torrent

, if what the torrent downloads contains folders, the download path will be something like this:

C:\\Path\\With Spaces\\torrent_folder\torrent_file.txt

And that single slash ("\") is inconsistent with the others, therefore, deluge returns the error

The filename, directory name, or volume label syntax is incorrect: C:\\Path\\With Spaces\\torrent_folder\torrent_file.txt

Paths containing no white spaces, or torrents that do not have a folder in their download do not have this issue.

Image: http://i.imgur.com/m5g77nv.png

Attachments (1)

x.png (71.2 KB) - added by Joe96 18 months ago.

Download all attachments as: .zip

Change History (9)

Changed 18 months ago by Joe96

comment:1 Changed 18 months ago by Joe96

In

deluge\ui\console\commands\add.py

on line 62, there is:

t_options["download_location"] = os.path.expanduser(options["path"])

I changed that to

t_options["download_location"] = os.path.abspath(options["path"])

And it seems to work fine. abspath turns the double slashes into single slashes, while expanduser doesn't.

Last edited 18 months ago by Joe96 (previous) (diff)

comment:2 Changed 18 months ago by andar

Why not both?

comment:3 Changed 18 months ago by Joe96

Actually, you're right. I excluded the os.path.expanduser because i don't need it. The reason i used the deluge-console add command was because i wanted to make a python script that adds new torrents automatically, and the path i provide is always the full path, but to address this bug, the correct fix would be

t_options["download_location"] = os.path.abspath(os.path.expanduser(options["path"]))
Last edited 18 months ago by Joe96 (previous) (diff)

comment:4 Changed 18 months ago by Cas

  • Milestone changed from 1.3.x to 1.3.13
  • Owner set to Cas
  • Status changed from new to accepted

comment:5 Changed 18 months ago by Cas

Just to note abspath calls `normpath` which is what actually fixes this issue. It's helpful however using abspath in this case as a relative folder could also be provided.

comment:6 Changed 17 months ago by Cas

  • Milestone changed from 1.3.13 to 2.0

Fixed 1.3-stable: [a1e66a4dc154]

Will also need fixing in develop

comment:7 Changed 8 months ago by Cas

  • Resolution set to Fixed
  • Status changed from accepted to closed

develop: [ec5c8bafb6]

comment:8 Changed 8 months ago by Cas

  • Milestone changed from 2.0 to 1.3.13
Note: See TracTickets for help on using tickets.