mirror of
https://github.com/Radarr/Radarr
synced 2025-01-04 06:23:32 +00:00
Fixed: Trying to add a movie when root folders hadn't populated
Co-Authored-By: Mark McDowall <markus101@users.noreply.github.com>
This commit is contained in:
parent
00921ed839
commit
1b7f52e013
2 changed files with 27 additions and 0 deletions
|
@ -95,6 +95,27 @@ class RootFolderSelectInputConnector extends Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
componentDidUpdate(prevProps) {
|
||||||
|
const {
|
||||||
|
name,
|
||||||
|
value,
|
||||||
|
values,
|
||||||
|
onChange
|
||||||
|
} = this.props;
|
||||||
|
|
||||||
|
if (prevProps.values === values) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!value && values.length && values.some((v) => !!v.key && v.key !== ADD_NEW_KEY)) {
|
||||||
|
const defaultValue = values[0];
|
||||||
|
|
||||||
|
if (defaultValue.key !== ADD_NEW_KEY) {
|
||||||
|
onChange({ name, value: defaultValue.key });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Listeners
|
// Listeners
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,12 @@ protected override bool IsValid(PropertyValidatorContext context)
|
||||||
}
|
}
|
||||||
|
|
||||||
var rootFolderPath = context.PropertyValue.ToString();
|
var rootFolderPath = context.PropertyValue.ToString();
|
||||||
|
|
||||||
|
if (rootFolderPath.IsNullOrWhiteSpace())
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
var rootFolder = new DirectoryInfo(rootFolderPath).Name;
|
var rootFolder = new DirectoryInfo(rootFolderPath).Name;
|
||||||
var movie = movieResource.ToModel();
|
var movie = movieResource.ToModel();
|
||||||
var movieFolder = _fileNameBuilder.GetMovieFolder(movie);
|
var movieFolder = _fileNameBuilder.GetMovieFolder(movie);
|
||||||
|
|
Loading…
Reference in a new issue