From d22c6f17a3ec4474b86ecfc5ef503cb4cae92dd9 Mon Sep 17 00:00:00 2001 From: claude-bot Date: Fri, 5 Jun 2026 01:57:30 +0900 Subject: [PATCH] store: rename file/list JSON when pack key changes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit renamePack 가 manifest 정의와 약관 폴더는 새 키로 옮기면서 정작 음악·사진 목록(file/list/.json)은 옛 키 파일에 남겨, 이름 변경 후 목록이 비어 보이던 버그 수정. 약관 폴더와 동일하게 fsp.rename 으로 옮기고 옛 파일이 없으면(ENOENT) 무시한다. --- src/shared/store.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/shared/store.ts b/src/shared/store.ts index afeb5f2..37d14ac 100644 --- a/src/shared/store.ts +++ b/src/shared/store.ts @@ -206,6 +206,18 @@ export async function renamePack(oldKey: string, newKey: string, pack: PackDefin } catch (error) { if ((error as NodeJS.ErrnoException).code !== 'ENOENT') throw error } + // 음악·사진 목록 JSON(file/list/.json)도 함께 이름을 바꾼다. 이걸 빼먹으면 + // manifest 정의는 새 키로 옮겨졌는데 정작 목록 데이터는 옛 키 파일에 남아, + // 새 packKey 로는 빈 목록만 보이고 인스톨러도 곡/사진을 받지 못한다. + const oldListFile = path.join(fileListDirPath, `${oldKey}.json`) + const newListFile = path.join(fileListDirPath, `${safeNew}.json`) + try { + await fsp.mkdir(fileListDirPath, { recursive: true }) + await fsp.rename(oldListFile, newListFile) + } catch (error) { + // 옛 목록 파일이 없으면(한 번도 저장 안 한 새 pack) 그냥 둔다. + if ((error as NodeJS.ErrnoException).code !== 'ENOENT') throw error + } // 약관 폴더도 함께 이름을 바꾼다 (있는 경우만). pack 이름이 바뀌었는데 약관이 // 옛 폴더에 남아 있으면 인스톨러가 새 packKey 로 약관을 받지 못한다. const oldTermsDir = path.join(manifestTermsDirPath, oldKey)