diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2015-11-10 23:11:03 -0500 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2015-11-10 23:11:03 -0500 |
| commit | 98020809c8a770c29e6c32f4830f37a269d394f2 (patch) | |
| tree | ebe90eb42ad0d59f6f30997acae75fee881d1e24 | |
| parent | e1ea92890db9fa46ecf26479c2a70f04cb5225f1 (diff) | |
fix repeated errors when server has only readonly access
| -rw-r--r-- | MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs b/MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs index e107ea9f1..8ae88235a 100644 --- a/MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs +++ b/MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs @@ -532,9 +532,16 @@ namespace MediaBrowser.Server.Implementations.IO return false; } + // In order to determine if the file is being written to, we have to request write access + // But if the server only has readonly access, this is going to cause this entire algorithm to fail + // So we'll take a best guess about our access level + var requestedFileAccess = ConfigurationManager.Configuration.SaveLocalMeta + ? FileAccess.ReadWrite + : FileAccess.Read; + try { - using (_fileSystem.GetFileStream(path, FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite)) + using (_fileSystem.GetFileStream(path, FileMode.Open, requestedFileAccess, FileShare.ReadWrite)) { if (_updateTimer != null) { |
