Skip to content

Self-hosted personal gallery application with online photo management and albums, supporting Live/Motion Photos, EXIF parsing, geolocation recognition, and an explore map.

fix(storage-local): handle CJK characters in URL for storage path

Timothy Yine5ecf246632a
diff --git a/server/routes/storage/[...path].ts b/server/routes/storage/[...path].ts
index 017b5b4e..60c94cd7 100644
--- a/server/routes/storage/[...path].ts
+++ b/server/routes/storage/[...path].ts
@@ -40,7 +40,9 @@ export default defineEventHandler(async (event) => {
const p = getRouterParam(event, 'path') || ''
const relPathRaw = Array.isArray(p) ? p.join('/') : p
- const relPath = relPathRaw.replace(/\\/g, '/').replace(/\/+/g, '/').replace(/^\/+/, '')
+ // handle CJK characters in URL
+ const decodedPath = decodeURIComponent(relPathRaw)
+ const relPath = decodedPath.replace(/\\/g, '/').replace(/\/+/g, '/').replace(/^\/+/, '')
// 阻止路径穿越
if (relPath.includes('..')) {