aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Providers/Subtitles
diff options
context:
space:
mode:
authorBond_009 <bond.009@outlook.com>2021-05-05 14:39:50 +0200
committerBond_009 <bond.009@outlook.com>2021-05-05 14:39:50 +0200
commite432796f6f0f500830b1c90c233c4e4c07287190 (patch)
tree6b578d261f794ec93d6bd99a47ba81b4ba9dad17 /MediaBrowser.Providers/Subtitles
parentb6df85136347df691ebc774b9d48dc622cb63a04 (diff)
Minor improvements
Diffstat (limited to 'MediaBrowser.Providers/Subtitles')
-rw-r--r--MediaBrowser.Providers/Subtitles/SubtitleManager.cs12
1 files changed, 6 insertions, 6 deletions
diff --git a/MediaBrowser.Providers/Subtitles/SubtitleManager.cs b/MediaBrowser.Providers/Subtitles/SubtitleManager.cs
index 8d62343cb..bf0c853ae 100644
--- a/MediaBrowser.Providers/Subtitles/SubtitleManager.cs
+++ b/MediaBrowser.Providers/Subtitles/SubtitleManager.cs
@@ -207,7 +207,7 @@ namespace MediaBrowser.Providers.Subtitles
{
var mediaFolderPath = Path.GetFullPath(Path.Combine(video.ContainingFolderPath, saveFileName));
// TODO: Add some error handling to the API user: return BadRequest("Could not save subtitle, bad path.");
- if (mediaFolderPath.StartsWith(video.ContainingFolderPath))
+ if (mediaFolderPath.StartsWith(video.ContainingFolderPath, StringComparison.Ordinal))
{
savePaths.Add(mediaFolderPath);
}
@@ -216,7 +216,7 @@ namespace MediaBrowser.Providers.Subtitles
var internalPath = Path.GetFullPath(Path.Combine(video.GetInternalMetadataPath(), saveFileName));
// TODO: Add some error to the user: return BadRequest("Could not save subtitle, bad path.");
- if (internalPath.StartsWith(video.GetInternalMetadataPath()))
+ if (internalPath.StartsWith(video.GetInternalMetadataPath(), StringComparison.Ordinal))
{
savePaths.Add(internalPath);
}
@@ -234,7 +234,7 @@ namespace MediaBrowser.Providers.Subtitles
private async Task TrySaveToFiles(Stream stream, List<string> savePaths)
{
- Exception exceptionToThrow = null;
+ List<Exception> exs = null;
foreach (var savePath in savePaths)
{
@@ -256,7 +256,7 @@ namespace MediaBrowser.Providers.Subtitles
}
catch (Exception ex)
{
- exceptionToThrow ??= ex;
+ (exs ??= new List<Exception>()).Add(ex);
}
finally
{
@@ -266,9 +266,9 @@ namespace MediaBrowser.Providers.Subtitles
stream.Position = 0;
}
- if (exceptionToThrow != null)
+ if (exs != null)
{
- throw exceptionToThrow;
+ throw new AggregateException(exs);
}
}