fix: 제목에 괄호가 든 글의 이미지가 발행 때마다 지워지던 문제 수정 - #132
Merged
Merged
Conversation
- 📋 작업 내역
- `features/publish/lib/toSafePathSegment.ts` 추가
- NFC 정규화 후 문자와 숫자, `-`, `_` 이외의 문자를 `-` 로 바꾸고 이어진 `-` 를 하나로 합친다
- `features/publish/lib/getStorageFolder.ts` 추가
- `collection/category/title` 의 각 조각을 `toSafePathSegment` 로 정리해 폴더 경로를 만든다
- `uploadImage.ts` 와 `deleteStore.ts` 가 `getStorageFolder` 로 같은 폴더를 만든다
- `toStorageFileName.ts` 의 정리 단계를 `toSafePathSegment` 로 바꿨다
- spec: `toSafePathSegment` 7건, `getStorageFolder` 3건. 올린 파일의 주소에서 `getStoragePaths` 가 꺼낸 경로가 실제 경로와 같은지 확인한다
- 💡 설계 이유
- #129 는 파일 이름만 정리했다. 폴더 이름(`title`)은 `spaceToDash` 로 공백만 바뀌어 괄호가 남고, `getStoragePaths` 가 `)` 에서 폴더째 잘라 그 글의 썸네일과 본문 이미지가 발행할 때마다 모두 지워졌다. 운영의 `쌩 npm으로 MFE 구축하기 (1) : 개념` 썸네일이 404 인 것을 확인했다
- 라우트가 넘기는 `title` 은 Firestore 문서 id 로도 쓰여 바꿀 수 없다. 그래서 Storage 경로를 만드는 곳에서만 정리하고, 올리는 쪽과 지우는 쪽이 어긋나지 않게 한 함수를 함께 쓴다
- 파일 이름과 폴더 이름이 같은 규칙을 쓰도록 #129 의 치환을 `toSafePathSegment` 로 떼었다. 제목은 공백이 이미 `-` 로 바뀌어 있어 `-(1)-:-` 가 `---` 처럼 이어지므로 연속된 `-` 를 합친다
- 괄호가 든 옛 폴더는 `deleteStore` 가 새 폴더만 보므로 남는다. 사용자와 확인해 이 이슈 범위에서 뺐다
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Wisesaturn
commented
Sep 27, 2026
Wisesaturn
left a comment
Owner
Author
There was a problem hiding this comment.
Code Review
Found 1 issue:
-
[!NOTE]
P4.uploadImage.ts를 고쳤는데 JSDoc 이 아직@summary다 (.claude/rules/jsdoc.mdsays "기존 파일을 고칠 때 그 파일의@summary를 함께 바꾼다")blog/src/features/publish/api/uploadImage.ts
Lines 15 to 19 in 939fa97
Lines 1 to 4 in 939fa97
그 밖에 CLAUDE.md 와 .claude/rules/ 준수, 변경 라인 버그, git 이력(#104, #129)과의 정합, 이전 PR(#105, #130) 리뷰 코멘트, 주석과 @example 의 정확성을 확인했고 문제는 없었다. 세 발행 라우트와 create*.ts 가 uploadImage 와 deleteStore 에 같은 값을 넘기므로 두 쪽의 폴더가 어긋나지 않는다.
참고: 같은 카테고리에서 문장 부호만 다른 두 제목(X (1) 과 X 1)은 문서 id 는 다르지만 Storage 폴더가 같아져, 한쪽을 발행하면 다른 쪽 이미지가 지워질 수 있다. 지금 운영 문서에는 해당 사례가 없다.
- 📋 작업 내역 - `features/publish/api/uploadImage.ts` 의 `@summary` 를 `@description` 으로 바꾸고, 비어 있던 `@param`, `@returns` 를 채우고 `@throws` 를 추가 - 💡 설계 이유 - PR #132 코드 리뷰에서 나온 P4. `jsdoc.md` 는 기존 파일을 고칠 때 그 파일의 `@summary` 를 함께 바꾸라고 한다 - 주소가 비었거나 이미지가 아닌 응답이면 에러를 던지므로 `jsdoc.md` 에 따라 `@throws` 를 적었다
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request Type
관련 이슈
closes #131
작업 내용
이미지 폴더 이름도 안전한 문자로 바꿔 저장
-,_만 남기고 나머지를-로 바꿉니다. 예를 들어쌩-npm으로-MFE-구축하기-(1)-:-개념폴더는쌩-npm으로-MFE-구축하기-1-개념이 됩니다.-로 바꾼 제목에서-가 여럿 이어지지 않도록 하나로 합칩니다.검증
toSafePathSegment7건,getStorageFolder3건).pnpm test321건,pnpm typecheck, eslint 통과getStoragePaths가 꺼낸 경로가 실제 경로와 같은지 MFE 글의 제목으로 확인합니다