aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Api/ItemLookupService.cs
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Api/ItemLookupService.cs')
-rw-r--r--MediaBrowser.Api/ItemLookupService.cs19
1 files changed, 5 insertions, 14 deletions
diff --git a/MediaBrowser.Api/ItemLookupService.cs b/MediaBrowser.Api/ItemLookupService.cs
index bdb9133d3..1700a10cd 100644
--- a/MediaBrowser.Api/ItemLookupService.cs
+++ b/MediaBrowser.Api/ItemLookupService.cs
@@ -247,21 +247,18 @@ namespace MediaBrowser.Api
try
{
- using (var reader = new StreamReader(pointerCachePath))
- {
- contentPath = await reader.ReadToEndAsync().ConfigureAwait(false);
- }
+ contentPath = _fileSystem.ReadAllText(pointerCachePath);
if (_fileSystem.FileExists(contentPath))
{
return await ResultFactory.GetStaticFileResult(Request, contentPath).ConfigureAwait(false);
}
}
- catch (DirectoryNotFoundException)
+ catch (FileNotFoundException)
{
// Means the file isn't cached yet
}
- catch (FileNotFoundException)
+ catch (IOException)
{
// Means the file isn't cached yet
}
@@ -269,10 +266,7 @@ namespace MediaBrowser.Api
await DownloadImage(request.ProviderName, request.ImageUrl, urlHash, pointerCachePath).ConfigureAwait(false);
// Read the pointer file again
- using (var reader = new StreamReader(pointerCachePath))
- {
- contentPath = await reader.ReadToEndAsync().ConfigureAwait(false);
- }
+ contentPath = _fileSystem.ReadAllText(pointerCachePath);
return await ResultFactory.GetStaticFileResult(Request, contentPath).ConfigureAwait(false);
}
@@ -303,10 +297,7 @@ namespace MediaBrowser.Api
}
_fileSystem.CreateDirectory(Path.GetDirectoryName(pointerCachePath));
- using (var writer = new StreamWriter(pointerCachePath))
- {
- await writer.WriteAsync(fullCachePath).ConfigureAwait(false);
- }
+ _fileSystem.WriteAllText(pointerCachePath, fullCachePath);
}
/// <summary>