From 6bdfaae5d64f1f3acbd57c49bc8002fbce1cf70e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Thierry=20K=C3=A9chichian?= Date: Thu, 21 Dec 2023 20:39:07 +0100 Subject: [PATCH] Useless variable closure (#14869) --- .../Services/MediaFileStoreResolverMiddleware.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/OrchardCore.Modules/OrchardCore.Media/Services/MediaFileStoreResolverMiddleware.cs b/src/OrchardCore.Modules/OrchardCore.Media/Services/MediaFileStoreResolverMiddleware.cs index 7ee626f0d7f..2df251d0655 100644 --- a/src/OrchardCore.Modules/OrchardCore.Media/Services/MediaFileStoreResolverMiddleware.cs +++ b/src/OrchardCore.Modules/OrchardCore.Media/Services/MediaFileStoreResolverMiddleware.cs @@ -60,7 +60,7 @@ public async Task Invoke(HttpContext context) return; } - // subpath.Value returns an unescaped path value, subPath returns an escaped path value. + // subPath.Value returns an unescaped path value, subPath returns an escaped path value. var subPathValue = subPath.Value; var isFileCached = await _mediaFileStoreCache.IsCachedAsync(subPathValue); @@ -79,11 +79,11 @@ public async Task Invoke(HttpContext context) // When multiple requests occur for the same file we use a Lazy // to initialize the file store request once. - await _workers.GetOrAdd(subPathValue, x => new Lazy(async () => + await _workers.GetOrAdd(subPathValue, path => new Lazy(async () => { try { - var fileStoreEntry = await _mediaFileStore.GetFileInfoAsync(subPathValue); + var fileStoreEntry = await _mediaFileStore.GetFileInfoAsync(path); if (fileStoreEntry != null) { @@ -94,13 +94,13 @@ public async Task Invoke(HttpContext context) catch (Exception ex) { // Log the error, and pass to pipeline to handle as 404. - // Multiple requests at the same time will all recieve the same 404 + // Multiple requests at the same time will all receive the same 404 // as we use LazyThreadSafetyMode.ExecutionAndPublication. - _logger.LogError(ex, "Error retrieving file from media file store for request path {Path}", subPathValue); + _logger.LogError(ex, "Error retrieving file from media file store for request path {Path}", path); } finally { - _workers.TryRemove(subPathValue, out var writeTask); + _workers.TryRemove(path, out var writeTask); } }, LazyThreadSafetyMode.ExecutionAndPublication)).Value;