Jellyfin.Plugin.Stash icon indicating copy to clipboard operation
Jellyfin.Plugin.Stash copied to clipboard

Fails if filename matches more than one path in stash

Open C84186 opened this issue 11 months ago • 0 comments

I've noticed that metadata fetching seems to silently fail if a given scene name matches more than one file (for example, I have two files in stash named movie.2024.03.18.mp4, but in different folders).

I think this is due to the following logic:

https://github.com/DirtyRacer1337/Jellyfin.Plugin.Stash/blob/a9fc5bda9fa4e3eced69737570bed3576034f852/Jellyfin.Plugin.Stash/Providers/StashAPI.cs#L103-L108

The above seems unintentional, especially given that the block immediately after iterates over the list and adds them to the result:

https://github.com/DirtyRacer1337/Jellyfin.Plugin.Stash/blob/a9fc5bda9fa4e3eced69737570bed3576034f852/Jellyfin.Plugin.Stash/Providers/StashAPI.cs#L110-L121

I think the correct condition should be:

if (!searchResults.Count) return result;

As a side note, the first part of this conditon:

if (!string.IsNullOrEmpty(path)) 

is not relevant to the logic being modelled, and is redundant given that the check is already made above

https://github.com/DirtyRacer1337/Jellyfin.Plugin.Stash/blob/a9fc5bda9fa4e3eced69737570bed3576034f852/Jellyfin.Plugin.Stash/Providers/StashAPI.cs#L72-L80

C84186 avatar Mar 18 '24 03:03 C84186