Potential bug in editing/updating Library Properties when libraries have the same name. #1992

Closed
opened 2025-12-21 19:55:36 +01:00 by backuprepo · 1 comment
Owner

Originally created by @BaronGreenback on GitHub (Jul 31, 2020).

Came across this whilst investigating https://github.com/jellyfin/jellyfin/issues/1649.

Bug is in how the libraryOptions are stored against a folder. (Emby.Server.Implementations.Library.LibraryManager)

In AddVirtualFolder they are stored against virtualFolderPath which is a combination of the name of the folder and the the ApplicationsPath.DefaultUserViewPath. If this folder exists then a 1 is tacked to the end of it (this is where i think the error lies)

var rootFolderPath = _configurationManager.ApplicationPaths.DefaultUserViewsPath;
var virtualFolderPath = Path.Combine(rootFolderPath, name);

while (Directory.Exists(virtualFolderPath))
{
   name += "1";
   virtualFolderPath = Path.Combine(rootFolderPath, name);
}
...
CollectionFolder.SaveLibraryOptions(virtualFolderPath, options);

If the folder "Folder" exists, the options are stored against path "Folder1"

In UpdateMediaPath and AddMediaPath is it assumed the original path is unique

var rootFolderPath = _configurationManager.ApplicationPaths.DefaultUserViewsPath;
var virtualFolderPath = Path.Combine(rootFolderPath, virtualFolderName);
...
var libraryOptions = CollectionFolder.GetLibraryOptions(virtualFolderPath);
...
CollectionFolder.SaveLibraryOptions(virtualFolderPath, libraryOptions);

Options are assumed to be stored against "Folder", when they were stored against "Folder1".

Originally created by @BaronGreenback on GitHub (Jul 31, 2020). Came across this whilst investigating https://github.com/jellyfin/jellyfin/issues/1649. Bug is in how the libraryOptions are stored against a folder. (Emby.Server.Implementations.Library.LibraryManager) In AddVirtualFolder they are stored against virtualFolderPath which is a combination of the name of the folder and the the ApplicationsPath.DefaultUserViewPath. If this folder exists then a 1 is tacked to the end of it (this is where i think the error lies) ``` var rootFolderPath = _configurationManager.ApplicationPaths.DefaultUserViewsPath; var virtualFolderPath = Path.Combine(rootFolderPath, name); while (Directory.Exists(virtualFolderPath)) { name += "1"; virtualFolderPath = Path.Combine(rootFolderPath, name); } ... CollectionFolder.SaveLibraryOptions(virtualFolderPath, options); ``` If the folder "Folder" exists, the options are stored against path "<DefaultUserPath>Folder1" In UpdateMediaPath and AddMediaPath is it assumed the original path is unique ``` var rootFolderPath = _configurationManager.ApplicationPaths.DefaultUserViewsPath; var virtualFolderPath = Path.Combine(rootFolderPath, virtualFolderName); ... var libraryOptions = CollectionFolder.GetLibraryOptions(virtualFolderPath); ... CollectionFolder.SaveLibraryOptions(virtualFolderPath, libraryOptions); ``` Options are assumed to be stored against "Folder", when they were stored against "Folder1".
backuprepo 2025-12-21 19:55:36 +01:00
  • closed this issue
  • added the
    bug
    stale
    labels
Author
Owner

@stale[bot] commented on GitHub (Nov 29, 2020):

This issue has gone 120 days without comment. To avoid abandoned issues, it will be closed in 21 days if there are no new comments.
If you're the original submitter of this issue, please comment confirming if this issue still affects you in the latest release or nightlies, or close the issue if it has been fixed. If you're another user also affected by this bug, please comment confirming so. Either action will remove the stale label.
This bot exists to prevent issues from becoming stale and forgotten. Jellyfin is always moving forward, and bugs are often fixed as side effects of other changes. We therefore ask that bug report authors remain vigilant about their issues to ensure they are closed if fixed, or re-confirmed - perhaps with fresh logs or reproduction examples - regularly. If you have any questions you can reach us on Matrix or Social Media.

@stale[bot] commented on GitHub (Nov 29, 2020): This issue has gone 120 days without comment. To avoid abandoned issues, it will be closed in 21 days if there are no new comments. If you're the original submitter of this issue, please comment confirming if this issue still affects you in the latest release or nightlies, or close the issue if it has been fixed. If you're another user also affected by this bug, please comment confirming so. Either action will remove the stale label. This bot exists to prevent issues from becoming stale and forgotten. Jellyfin is always moving forward, and bugs are often fixed as side effects of other changes. We therefore ask that bug report authors remain vigilant about their issues to ensure they are closed if fixed, or re-confirmed - perhaps with fresh logs or reproduction examples - regularly. If you have any questions you can reach us on [Matrix or Social Media](https://docs.jellyfin.org/general/getting-help.html).
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: starred/jellyfin#1992
No description provided.