Explorar o código

Merge pull request #7810 from Bond-009/unaccpattern

(cherry picked from commit 5e343d30e198ca57926a13e1a6b05ae232091d86)
Signed-off-by: crobibero <cody@robibe.ro>
Cody Robibero %!s(int64=3) %!d(string=hai) anos
pai
achega
eb55f47f2e

+ 6 - 4
Jellyfin.Server/Program.cs

@@ -545,12 +545,14 @@ namespace Jellyfin.Server
             const string ResourcePath = "Jellyfin.Server.Resources.Configuration.logging.json";
             const string ResourcePath = "Jellyfin.Server.Resources.Configuration.logging.json";
             Stream resource = typeof(Program).Assembly.GetManifestResourceStream(ResourcePath)
             Stream resource = typeof(Program).Assembly.GetManifestResourceStream(ResourcePath)
                 ?? throw new InvalidOperationException($"Invalid resource path: '{ResourcePath}'");
                 ?? throw new InvalidOperationException($"Invalid resource path: '{ResourcePath}'");
-            Stream dst = new FileStream(configPath, FileMode.CreateNew, FileAccess.Write, FileShare.None, IODefaults.FileStreamBufferSize, FileOptions.Asynchronous);
             await using (resource.ConfigureAwait(false))
             await using (resource.ConfigureAwait(false))
-            await using (dst.ConfigureAwait(false))
             {
             {
-                // Copy the resource contents to the expected file path for the config file
-                await resource.CopyToAsync(dst).ConfigureAwait(false);
+                Stream dst = new FileStream(configPath, FileMode.CreateNew, FileAccess.Write, FileShare.None, IODefaults.FileStreamBufferSize, FileOptions.Asynchronous);
+                await using (dst.ConfigureAwait(false))
+                {
+                    // Copy the resource contents to the expected file path for the config file
+                    await resource.CopyToAsync(dst).ConfigureAwait(false);
+                }
             }
             }
         }
         }
 
 

+ 5 - 3
MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs

@@ -681,11 +681,13 @@ namespace MediaBrowser.MediaEncoding.Subtitles
             if (!string.Equals(text, newText, StringComparison.Ordinal))
             if (!string.Equals(text, newText, StringComparison.Ordinal))
             {
             {
                 var fileStream = new FileStream(file, FileMode.Create, FileAccess.Write, FileShare.None, IODefaults.FileStreamBufferSize, FileOptions.Asynchronous);
                 var fileStream = new FileStream(file, FileMode.Create, FileAccess.Write, FileShare.None, IODefaults.FileStreamBufferSize, FileOptions.Asynchronous);
-                var writer = new StreamWriter(fileStream, encoding);
                 await using (fileStream.ConfigureAwait(false))
                 await using (fileStream.ConfigureAwait(false))
-                await using (writer.ConfigureAwait(false))
                 {
                 {
-                    await writer.WriteAsync(newText.AsMemory(), cancellationToken).ConfigureAwait(false);
+                    var writer = new StreamWriter(fileStream, encoding);
+                    await using (writer.ConfigureAwait(false))
+                    {
+                        await writer.WriteAsync(newText.AsMemory(), cancellationToken).ConfigureAwait(false);
+                    }
                 }
                 }
             }
             }
         }
         }