diff options
| author | crobibero <cody@robibe.ro> | 2020-11-13 18:04:06 -0700 |
|---|---|---|
| committer | crobibero <cody@robibe.ro> | 2020-11-13 18:04:06 -0700 |
| commit | 73d2cb1c2a3a7cd1a30840a2b52921a3b81c6809 (patch) | |
| tree | 922229602e0dbff30c371e70ed16512fb27eaa1e /Jellyfin.Api/Controllers/RemoteImageController.cs | |
| parent | 24ac5cc353dd5b9930d43a5659d97037644fa58a (diff) | |
Updated based on review feedback
Diffstat (limited to 'Jellyfin.Api/Controllers/RemoteImageController.cs')
| -rw-r--r-- | Jellyfin.Api/Controllers/RemoteImageController.cs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Jellyfin.Api/Controllers/RemoteImageController.cs b/Jellyfin.Api/Controllers/RemoteImageController.cs index b4a9e5582..c2bfab175 100644 --- a/Jellyfin.Api/Controllers/RemoteImageController.cs +++ b/Jellyfin.Api/Controllers/RemoteImageController.cs @@ -257,12 +257,12 @@ namespace Jellyfin.Api.Controllers var ext = response.Content.Headers.ContentType.MediaType.Split('/').Last(); var fullCachePath = GetFullCachePath(urlHash + "." + ext); - var fullCacheDirectory = Path.GetDirectoryName(fullCachePath) ?? throw new ResourceNotFoundException(nameof(fullCachePath)); + var fullCacheDirectory = Path.GetDirectoryName(fullCachePath) ?? throw new ResourceNotFoundException($"Provided path ({fullCachePath}) is not valid."); Directory.CreateDirectory(fullCacheDirectory); await using var fileStream = new FileStream(fullCachePath, FileMode.Create, FileAccess.Write, FileShare.Read, IODefaults.FileStreamBufferSize, true); await response.Content.CopyToAsync(fileStream).ConfigureAwait(false); - var pointerCacheDirectory = Path.GetDirectoryName(pointerCachePath) ?? throw new ResourceNotFoundException(nameof(pointerCachePath)); + var pointerCacheDirectory = Path.GetDirectoryName(pointerCachePath) ?? throw new ArgumentException($"Provided path ({pointerCachePath}) is not valid.", nameof(pointerCachePath)); Directory.CreateDirectory(pointerCacheDirectory); await System.IO.File.WriteAllTextAsync(pointerCachePath, fullCachePath, CancellationToken.None) .ConfigureAwait(false); |
