mirror of
https://github.com/usememos/memos.git
synced 2025-06-05 22:09:59 +02:00
chore: use consistent relative paths for resources (#2683)
- always store resources with a relative path with forward slashes, which will be transformed as needed when the file is accessed - fix an issue with thumbnail generation on Windows - add several validations for local storage setting - improve front-end error feedback when changing local storage - add migrations to make existing resource paths relative (not needed, but improves database consistency)
This commit is contained in:
@ -27,12 +27,21 @@ const UpdateLocalStorageDialog: React.FC<Props> = (props: Props) => {
|
||||
try {
|
||||
await api.upsertSystemSetting({
|
||||
name: "local-storage-path",
|
||||
value: JSON.stringify(path),
|
||||
value: JSON.stringify(path.trim()),
|
||||
});
|
||||
await globalStore.fetchSystemStatus();
|
||||
} catch (error: any) {
|
||||
console.error(error);
|
||||
toast.error(error.response.data.message);
|
||||
if (error.response.data.error) {
|
||||
const errorText = error.response.data.error as string;
|
||||
const internalIndex = errorText.indexOf("internal=");
|
||||
if (internalIndex !== -1) {
|
||||
const internalError = errorText.substring(internalIndex + 9);
|
||||
toast.error(internalError);
|
||||
}
|
||||
} else {
|
||||
toast.error(error.response.data.message);
|
||||
}
|
||||
}
|
||||
if (confirmCallback) {
|
||||
confirmCallback();
|
||||
|
Reference in New Issue
Block a user