mirror of https://github.com/usememos/memos
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)pull/2762/head
parent
ea87a1dc0c
commit
411e807dcc
@ -0,0 +1,19 @@
|
|||||||
|
-- Make resource internal_path relative (to MEMOS_DATA) and replace backslash with slash
|
||||||
|
-- This is a best-effort approach, but even if it fails, it won't break assets from loading
|
||||||
|
UPDATE resource
|
||||||
|
SET
|
||||||
|
internal_path = REPLACE (internal_path, '\\', '/')
|
||||||
|
WHERE
|
||||||
|
internal_path LIKE '%assets\\\%';
|
||||||
|
|
||||||
|
UPDATE resource
|
||||||
|
SET
|
||||||
|
internal_path = REPLACE (
|
||||||
|
internal_path,
|
||||||
|
SUBSTR (
|
||||||
|
internal_path,
|
||||||
|
1,
|
||||||
|
INSTR (internal_path, '/assets')
|
||||||
|
),
|
||||||
|
''
|
||||||
|
);
|
@ -0,0 +1,19 @@
|
|||||||
|
-- Make resource internal_path relative (to MEMOS_DATA) and replace backslash with slash
|
||||||
|
-- This is a best-effort approach, but even if it fails, it won't break assets from loading
|
||||||
|
UPDATE resource
|
||||||
|
SET
|
||||||
|
internal_path = REPLACE (internal_path, '\', '/')
|
||||||
|
WHERE
|
||||||
|
internal_path LIKE '%assets\\%';
|
||||||
|
|
||||||
|
UPDATE resource
|
||||||
|
SET
|
||||||
|
internal_path = REPLACE (
|
||||||
|
internal_path,
|
||||||
|
SUBSTRING(
|
||||||
|
internal_path
|
||||||
|
FROM
|
||||||
|
1 FOR POSITION('/assets' IN internal_path)
|
||||||
|
),
|
||||||
|
''
|
||||||
|
);
|
@ -0,0 +1,19 @@
|
|||||||
|
-- Make resource internal_path relative (to MEMOS_DATA) and replace backslash with slash
|
||||||
|
-- This is a best-effort approach, but even if it fails, it won't break assets from loading
|
||||||
|
UPDATE resource
|
||||||
|
SET
|
||||||
|
internal_path = REPLACE (internal_path, '\', '/')
|
||||||
|
WHERE
|
||||||
|
internal_path LIKE '%assets\%';
|
||||||
|
|
||||||
|
UPDATE resource
|
||||||
|
SET
|
||||||
|
internal_path = REPLACE (
|
||||||
|
internal_path,
|
||||||
|
SUBSTR (
|
||||||
|
internal_path,
|
||||||
|
1,
|
||||||
|
INSTR (internal_path, '/assets')
|
||||||
|
),
|
||||||
|
''
|
||||||
|
);
|
Loading…
Reference in New Issue