mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-01-15 16:33:25 -03:00
Validate encoder path (#14996)
This commit is contained in:
@@ -18,10 +18,16 @@ namespace MediaBrowser.MediaEncoding.Configuration
|
|||||||
|
|
||||||
public void Validate(object oldConfig, object newConfig)
|
public void Validate(object oldConfig, object newConfig)
|
||||||
{
|
{
|
||||||
var newPath = ((EncodingOptions)newConfig).TranscodingTempPath;
|
var oldEncodingOptions = (EncodingOptions)oldConfig;
|
||||||
|
var newEncodingOptions = (EncodingOptions)newConfig;
|
||||||
|
|
||||||
|
ArgumentNullException.ThrowIfNull(oldEncodingOptions, nameof(oldConfig));
|
||||||
|
ArgumentNullException.ThrowIfNull(newEncodingOptions, nameof(newConfig));
|
||||||
|
|
||||||
|
var newPath = newEncodingOptions.TranscodingTempPath;
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(newPath)
|
if (!string.IsNullOrWhiteSpace(newPath)
|
||||||
&& !string.Equals(((EncodingOptions)oldConfig).TranscodingTempPath, newPath, StringComparison.Ordinal))
|
&& !string.Equals(oldEncodingOptions.TranscodingTempPath, newPath, StringComparison.Ordinal))
|
||||||
{
|
{
|
||||||
// Validate
|
// Validate
|
||||||
if (!Directory.Exists(newPath))
|
if (!Directory.Exists(newPath))
|
||||||
@@ -33,6 +39,12 @@ namespace MediaBrowser.MediaEncoding.Configuration
|
|||||||
newPath));
|
newPath));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!string.IsNullOrWhiteSpace(newEncodingOptions.EncoderAppPath)
|
||||||
|
&& !string.Equals(oldEncodingOptions.EncoderAppPath, newEncodingOptions.EncoderAppPath, StringComparison.Ordinal))
|
||||||
|
{
|
||||||
|
throw new InvalidOperationException("Unable to update encoder app path.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user