[filescanner] Fix building directory structure with trailing '/'

Library directories with a trailing '/' (like '/srv/music/') lead to an
unbrowsable directory structure. The trailing '/' resulted in an update
to the library directory in the directories table with a parent_id
pointing to itself.
This commit is contained in:
chme 2016-07-31 07:41:11 +02:00
parent 3dbf6d2416
commit cebf07b2f8
1 changed files with 6 additions and 0 deletions

View File

@ -1092,6 +1092,12 @@ process_parent_directories(char *path)
ptr = path + 1;
while (ptr && (ptr = strchr(ptr, '/')))
{
if ((ptr - path) > 0)
{
// Do not process trailing '/'
break;
}
strncpy(buf, path, (ptr - path));
buf[(ptr - path)] = '\0';