diff --git a/src/NzbDrone.Core/MediaFiles/DiskScanService.cs b/src/NzbDrone.Core/MediaFiles/DiskScanService.cs index 4bdfe04b7..13a1cd83a 100644 --- a/src/NzbDrone.Core/MediaFiles/DiskScanService.cs +++ b/src/NzbDrone.Core/MediaFiles/DiskScanService.cs @@ -1,4 +1,5 @@ -using System.Diagnostics; +using System; +using System.Diagnostics; using System.IO; using System.Linq; using NLog; @@ -74,6 +75,7 @@ namespace NzbDrone.Core.MediaFiles { _logger.Debug("Creating missing series folder: {0}", series.Path); _diskProvider.CreateFolder(series.Path); + SetPermissions(series.Path); } else { @@ -112,6 +114,27 @@ namespace NzbDrone.Core.MediaFiles return mediaFileList.ToArray(); } + private void SetPermissions(String path) + { + if (!_configService.SetPermissionsLinux) + { + return; + } + + try + { + var permissions = _configService.FolderChmod; + _diskProvider.SetPermissions(path, permissions, _configService.ChownUser, _configService.ChownGroup); + } + + catch (Exception ex) + { + + _logger.WarnException("Unable to apply permissions to: " + path, ex); + _logger.DebugException(ex.Message, ex); + } + } + public void Handle(SeriesUpdatedEvent message) { Scan(message.Series);