mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
Fix external file check for shorter names
This commit is contained in:
parent
fab5f37e0e
commit
f7118bebfd
@ -166,7 +166,8 @@ namespace MediaBrowser.Providers.MediaInfo
|
|||||||
foreach (var file in files)
|
foreach (var file in files)
|
||||||
{
|
{
|
||||||
var fileNameWithoutExtension = Path.GetFileNameWithoutExtension(file.AsSpan());
|
var fileNameWithoutExtension = Path.GetFileNameWithoutExtension(file.AsSpan());
|
||||||
if (prefix.Equals(fileNameWithoutExtension[..prefix.Length], StringComparison.OrdinalIgnoreCase)
|
if (fileNameWithoutExtension.Length >= prefix.Length
|
||||||
|
&& prefix.Equals(fileNameWithoutExtension[..prefix.Length], StringComparison.OrdinalIgnoreCase)
|
||||||
&& (fileNameWithoutExtension.Length == prefix.Length || _namingOptions.MediaFlagDelimiters.Contains(fileNameWithoutExtension[prefix.Length])))
|
&& (fileNameWithoutExtension.Length == prefix.Length || _namingOptions.MediaFlagDelimiters.Contains(fileNameWithoutExtension[prefix.Length])))
|
||||||
{
|
{
|
||||||
var externalPathInfo = _externalPathParser.ParseFile(file, fileNameWithoutExtension[prefix.Length..].ToString());
|
var externalPathInfo = _externalPathParser.ParseFile(file, fileNameWithoutExtension[prefix.Length..].ToString());
|
||||||
|
@ -157,6 +157,7 @@ public class MediaInfoResolverTests
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
|
[InlineData("cover.jpg")]
|
||||||
[InlineData("My.Video.mp3")]
|
[InlineData("My.Video.mp3")]
|
||||||
[InlineData("My.Video.png")]
|
[InlineData("My.Video.png")]
|
||||||
[InlineData("My.Video.txt")]
|
[InlineData("My.Video.txt")]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user