Colons in folder names can cause confusion

Issue #411 resolved
prl created an issue

In the Movie Player, if a folder has a name containing a colon, its contents aren't displayed.

This is caused by the fact that the string format of a serviceref is:

REFTYPE:FLAGS:STYPE:SID:TSID:ONID:NS:PARENT_SID:PARENT_TSID:UNUSED:PATH:NAME

and servicerefs for folders are constructed in Screens.MovieSelection and Components.MovieList using code like:

eServiceReference("2:0:1:0:0:0:0:0:0:0:" + currentDir)

If currentDir is something like "/a/b/c:d", then the string is parsed as having PATH="/a/b/c" and NAME="d", so the path component of the serviceref will be incorrect.

Similar issues may occur if there is a "%" in the path.

There are similar problems in the FileCommander plugin, Components.FileList and in the ShoutCast plugin.

The fix is to change the code to:

import urllib
...
eServiceReference("2:0:1:0:0:0:0:0:0:0:" + urllib.encode(currentDir))

or better,

eServiceReference(eServiceReference.idFile, eServiceReference.isDirectory, currentDir)

Replication steps

In the Movie Player (MEDIA from live TV), create a directory with a name with a colon in it (like "a:a"). Use GREEN Move to move a recording into the directory, and then navigate into the directory. The directory will appear empty.

Return to the previous directory and rename the directory to remove the colon. Navigate back into the renamed directory and the contents will be visible.

Similar problem in FileCommander:

In the Movie Player (MEDIA from live TV), create a directory with a name with a colon in it (like "a:a"). Use GREEN Move to move a recording into the directory,

Exit the Movie Player to live TV, then enter the FileCommander with MENU>Sources>T4, and navigate into the folder created above. Scroll down to the recording's .ts file, and press OK. The recording will not play.

Exit the FileCommander, rename the folder to remove the colon, re-enter the FileCommander, navigate back to the renamed folder, Scroll down to the recording's .ts file, and press OK. The recording now plays normally.

Similar problem in Components.FileList.MultiFileSelectList

This problem only appears in instances of MultiFileSelectList that have useServiceRef=True.

There don't appear to be any such uses in the easy-ui-4 code, so this part of the problem can't be demonstrated.

Comments (7)

  1. Peter Urbanec

    Fix bug #411: Colons in folder names can cause confusion

    Changed creation of eServiceRefs for file system directories from using

    eServiceReference("2:0:1:0:0:0:0:0:0:0:" + directory)

    to

    eServiceReference(eServiceReference.idFile, eServiceReference.isDirectory, directory)

    In the former case, directory paths that contained a ':' were parsed as part path and part name: "/a/b/c:d" would incorrectly have an eServiceReference.path = "/a/b/c" and eServiceReference.name = "d" instead of the correct eServiceReference.path = "/a/b/c:d" and eServiceReference.name = ""

    Also changed the use of numerical constants for the arguments to eServiceReference() to symbolic constants.

    → <<cset 5fc66095cc34>>

  2. Peter Urbanec

    Fix bug #411: Colons in folder names can cause confusion - rework

    Fix error in commit 5fc6609 that meant that when returning to a parent directory in the MoviePlayer, the initial focus wasn't on the previous directory.

    There were possibly other bugs with caused by the same error.

    Fix eServiceReference constructors for file system directories that were in the form: ref = eServiceReference( eServiceReference.idFile, eServiceReference.isDirectory, path )

    and should have been: ref = eServiceReference( eServiceReference.idFile, eServiceReference.noFlags, 1 ) ref.setPath(path)

    Symbolic names are needed for the reference path type for filesystem servicerefs.

    Also use eServiceReference.noFlags in some constructors instead of 0.

    → <<cset 239ef6bdb34e>>

  3. Log in to comment