mirror of
https://github.com/owntone/owntone-server.git
synced 2025-04-01 18:21:31 -04:00
[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:
parent
3dbf6d2416
commit
cebf07b2f8
@ -1092,6 +1092,12 @@ process_parent_directories(char *path)
|
|||||||
ptr = path + 1;
|
ptr = path + 1;
|
||||||
while (ptr && (ptr = strchr(ptr, '/')))
|
while (ptr && (ptr = strchr(ptr, '/')))
|
||||||
{
|
{
|
||||||
|
if ((ptr - path) > 0)
|
||||||
|
{
|
||||||
|
// Do not process trailing '/'
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
strncpy(buf, path, (ptr - path));
|
strncpy(buf, path, (ptr - path));
|
||||||
buf[(ptr - path)] = '\0';
|
buf[(ptr - path)] = '\0';
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user