mirror of
https://github.com/Grasscutters/Cultivation.git
synced 2025-12-14 16:14:48 +01:00
fix invalid file paths
This commit is contained in:
@@ -98,8 +98,12 @@ class App extends React.Component<IProps, IState> {
|
|||||||
const isUrl = /^(?:http(s)?:\/\/)/gm.test(custom_bg)
|
const isUrl = /^(?:http(s)?:\/\/)/gm.test(custom_bg)
|
||||||
|
|
||||||
if (!isUrl) {
|
if (!isUrl) {
|
||||||
|
const isValid = await invoke('dir_exists', {
|
||||||
|
path: custom_bg
|
||||||
|
})
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
bgFile: convertFileSrc(custom_bg)
|
bgFile: isValid ? convertFileSrc(custom_bg) : DEFAULT_BG
|
||||||
}, this.forceUpdate)
|
}, this.forceUpdate)
|
||||||
} else {
|
} else {
|
||||||
// Check if URL returns a valid image.
|
// Check if URL returns a valid image.
|
||||||
|
|||||||
Reference in New Issue
Block a user