Opened 11 months ago

Closed 8 months ago

#3041 closed bug (Invalid)

Execute plugin fails when filename contains two consecutive spaces

Reported by: linearray Owned by:
Priority: minor Milestone: 1.3.16
Component: Plugin Version: 1.3.15
Keywords: Cc:

Description

The "name" option of a torrent is used for display purposes https://github.com/deluge-torrent/deluge/blob/develop/deluge/core/torrent.py#L128

In particular, it appears that several consecutive space (0x20) characters are coalesced into one. This can be easily verified by creating a torrent file for a file named

Untitled  .txt

(note the two spaces) and then looking at the entry in the torrent list in e.g. WebUI, which is

Untitled .txt

(one space).

The file written to disk, however, retains the original name with two spaces. This becomes a problem when using the Execute plugin, because it reads the display name https://github.com/deluge-torrent/deluge/blob/develop/deluge/plugins/Execute/deluge/plugins/execute/core.py#L98, which then has no relation to the actual filename, rendering it useless for all file operations.

I am not entirely sure where the coalescing happens, perhaps here https://github.com/deluge-torrent/deluge/blob/develop/deluge/core/torrentmanager.py#L331, neither am I sure about the best way to correct this. If the coalescing is intentional for display purposes, then the Execute plugin probably should not read the name option and instead read the name of the top-most file of a torrent.

Change History (2)

comment:1 Changed 11 months ago by Cas

  • Milestone changed from needs verified to 1.3.16

comment:2 Changed 8 months ago by linearray

  • Resolution set to Invalid
  • Status changed from new to closed

I must apologize, it appears this bug was a mirage due to a number of bugs in my own script. In fact, this is the result of a bug in the documentation of the Execute plugin that I blindly copied. Bash is very peculiar about whitespace and variables potentially containing multiple spaces must be double-quoted, otherwise mayhem ensues.

I fixed the documentation on the plugins page.

Note: See TracTickets for help on using tickets.