Incorrect .Trash path can be chosen for some file paths

Issue #555 new
prl created an issue

The intention of the trash system seems to be that if a recording or media file is placed into trash, it goes into mountpoint/movie/.Trash if the file is under mountpoint/movie, and into mountpoint/.Trash for all other files under mountpoint.

However, the test in Tools.Trashcan.getTrashFolder() is too weak, and files under any path that contains the string "/movie" (e.g. /media/hdd/Archive/movie) will be placed in trash mountpoint/movie/.Trash.

The test needs to be tightened so that the match is exact on the name "movie", and it only applies to mountpoint/movie.

Replication steps

With the trashcan enabled...

Create directory /media/hdd/Archive/movie. Add a "media file" to it, e.g. with

touch /media/hdd/Archive/movie/fake.mpg

A real media file or recording can also be used.

In the media browser (MEDIA from live TV), navigate to /media/hdd/Archive/movie, then navigate to fake.mpg, and then RED Delete.

The file fake.mpg is moved to /media/hdd/movie/.Trash, rather than media/hdd/.Trash.

Comments (3)

  1. IanSav

    If we are changing the Trash processing I would like to suggest that there only ever be ONE .Trash per volume / device. The .Trash could be in the root directory of the device unless some other preference is expressed.

    The Trash entry in MovieSelection should be made visible in all folders selected for browsing but the actual Trash folder is the one .Trash folder for the device / volume as suggested above.

    The meaning of Trash in MovieSelection could change depending on the device being browsed. Alternatively the MovieSelection Trash view could be faked to show the current device's .Trash folder as the contents of Trash but links/sub folders can be provided to link to any other volume's .Trash folders that are currently available.

    Empty Trash could then be configured to empty the current volume's trash, all trash folders or ask the user. Similarly pressing Delete on Trash would be the same as "Empty Trash" though pressing Delete on any of the linked volume .Trash folders within Trash would simply only empty the .Trash on the nominated volume.

  2. Log in to comment