fix Videos default dir name and strip tts voice subdir in save-result

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-05 00:42:47 +00:00
co-authored by Claude Opus 4.6
parent 7bfa36e5cf
commit 9a95773664
+6 -1
View File
@@ -17,7 +17,7 @@ async function getUserTtsVoice(userId: number): Promise<string | null> {
return null;
}
const DEFAULT_HOME_DIRS = ['Downloads', 'Documents', 'Music', 'Video', 'Pictures', 'Onboarding'];
const DEFAULT_HOME_DIRS = ['Downloads', 'Documents', 'Music', 'Videos', 'Pictures', 'Onboarding'];
const OLD_CACHE_DIRS = ['ocr', 'tts', 'transcriptions', 'audio', 'video'];
const ONBOARDING_SEED = join(DATA_PATH, 'Onboarding');
const ONBOARDING_ADMIN_SEED = join(DATA_PATH, 'Onboarding_Admin');
@@ -368,6 +368,11 @@ router.post('/save-result', async (ctx) => {
if (!prefix) throw errors.BAD_REQUEST('Not a cached result path');
let relativePath = cachedPath.slice(prefix.length);
// TTS cache includes a voice subdirectory (e.g. am_liam/) — strip it
if (prefix === 'cache/tts/') {
const slashIdx = relativePath.indexOf('/');
if (slashIdx !== -1) relativePath = relativePath.slice(slashIdx + 1);
}
// Strip any nested cache prefixes (e.g. tts/ocr/photos/file.mp3 → photos/file.mp3)
let nested: string | undefined;
while ((nested = CACHE_PREFIXES.find((p) => relativePath.startsWith(p)))) {