From 56e135f5e664835a89e52d0ced91b9009b390818 Mon Sep 17 00:00:00 2001 From: nyanmisaka Date: Sat, 18 Jun 2022 01:50:08 +0800 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Claus Vium --- Jellyfin.Api/Helpers/StreamingHelpers.cs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/Jellyfin.Api/Helpers/StreamingHelpers.cs b/Jellyfin.Api/Helpers/StreamingHelpers.cs index 54234c56a3..87544b3e3e 100644 --- a/Jellyfin.Api/Helpers/StreamingHelpers.cs +++ b/Jellyfin.Api/Helpers/StreamingHelpers.cs @@ -476,14 +476,10 @@ namespace Jellyfin.Api.Helpers } // Fallback to the container of mediaSource - if (mediaSource != null && !string.IsNullOrEmpty(mediaSource.Container)) + if (!string.IsNullOrEmpty(mediaSource?.Container)) { - var containers = mediaSource.Container.Split(',', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries); - - if (containers.Length > 0) - { - return '.' + containers[0]; - } + var idx = mediaSource.Container.IndexOf(',', StringComparison.OrdinalIgnoreCase); + return '.' + (idx == -1 ? mediaSource.Container : mediaSource.Container[..idx]).Trim(); } return null;