Merge pull request #12443 from gnattu/check-attach-path-for-null

Check attachment path for null before use
This commit is contained in:
Bond-009 2024-08-14 16:10:11 +02:00 committed by GitHub
commit 122da8f447
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -89,7 +89,8 @@ namespace MediaBrowser.MediaEncoding.Attachments
string outputPath, string outputPath,
CancellationToken cancellationToken) CancellationToken cancellationToken)
{ {
var shouldExtractOneByOne = mediaSource.MediaAttachments.Any(a => a.FileName.Contains('/', StringComparison.OrdinalIgnoreCase) || a.FileName.Contains('\\', StringComparison.OrdinalIgnoreCase)); var shouldExtractOneByOne = mediaSource.MediaAttachments.Any(a => !string.IsNullOrEmpty(a.FileName)
&& (a.FileName.Contains('/', StringComparison.OrdinalIgnoreCase) || a.FileName.Contains('\\', StringComparison.OrdinalIgnoreCase)));
if (shouldExtractOneByOne) if (shouldExtractOneByOne)
{ {
var attachmentIndexes = mediaSource.MediaAttachments.Select(a => a.Index); var attachmentIndexes = mediaSource.MediaAttachments.Select(a => a.Index);