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:
@@ -17,7 +17,7 @@ async function getUserTtsVoice(userId: number): Promise<string | null> {
|
|||||||
return 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 OLD_CACHE_DIRS = ['ocr', 'tts', 'transcriptions', 'audio', 'video'];
|
||||||
const ONBOARDING_SEED = join(DATA_PATH, 'Onboarding');
|
const ONBOARDING_SEED = join(DATA_PATH, 'Onboarding');
|
||||||
const ONBOARDING_ADMIN_SEED = join(DATA_PATH, 'Onboarding_Admin');
|
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');
|
if (!prefix) throw errors.BAD_REQUEST('Not a cached result path');
|
||||||
|
|
||||||
let relativePath = cachedPath.slice(prefix.length);
|
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)
|
// Strip any nested cache prefixes (e.g. tts/ocr/photos/file.mp3 → photos/file.mp3)
|
||||||
let nested: string | undefined;
|
let nested: string | undefined;
|
||||||
while ((nested = CACHE_PREFIXES.find((p) => relativePath.startsWith(p)))) {
|
while ((nested = CACHE_PREFIXES.find((p) => relativePath.startsWith(p)))) {
|
||||||
|
|||||||
Reference in New Issue
Block a user