Repository navigation
Allow Chinese tags and document categories - #6
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d96b4ae09e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (!window.categoryAclChoices) window.categoryAclChoices = {}; | ||
|
|
||
| if (!/^[가-힣a-zA-Z0-9\s_.-]+$/.test(cleanTag)) { | ||
| if (!/^[\p{Script=Han}가-힣a-zA-Z0-9\s_.-]+$/u.test(cleanTag)) { |
There was a problem hiding this comment.
Update the exported shared autocomplete validator
When an application consumes the public @eoeoe2/wiki-shared/editor/autocomplete export, Chinese categories are still rejected client-side because the duplicate validator in packages/wiki-shared/src/editor/autocomplete.ts:1558 retains the Hangul/ASCII-only regex. Updating only this app-specific copy therefore leaves shared-package consumers unable to use the newly supported categories even though the server accepts them; keep the exported implementation in sync.
Useful? React with 👍 / 👎.
| * 입력은 배열 / JSON 배열 문자열 / 쉼표구분 문자열을 모두 허용한다. | ||
| */ | ||
| const TAG_VALID_RE = /^[가-힣a-zA-Z0-9 _.-]+$/; | ||
| const TAG_VALID_RE = /^[\p{Script=Han}가-힣a-zA-Z0-9 _.-]+$/u; |
There was a problem hiding this comment.
Count supplementary Han as single tag characters
When a media tag contains newly accepted supplementary Han characters such as 𠀀, the existing trimmed.length > TAG_MAX_LENGTH check at line 41 counts each character as two UTF-16 code units. Consequently, a valid 26-character Extension-B tag is silently discarded as longer than the advertised 50-character limit, and the client performs the same incorrect check in src/client/common.ts; count Unicode code points consistently for the limit.
Useful? React with 👍 / 👎.
| // 컨테이너에 버블 UI + 자동완성(/api/media/search-tags)을 장착한다. | ||
| // 업로드 모달, 이미지 검색 모달, 이미지 문서 편집 모달에서 공통 사용한다. | ||
| const MEDIA_TAG_VALID_RE = /^[가-힣a-zA-Z0-9 _.-]+$/; | ||
| const MEDIA_TAG_VALID_RE = /^[\p{Script=Han}가-힣a-zA-Z0-9 _.-]+$/u; |
There was a problem hiding this comment.
Include supplementary Han in tag prefix searches
For an accepted tag whose next character after the current query is supplementary Han, such as tag 中𠀀 with query 中, the autocomplete endpoint's upper bound ${q}\uffff in src/routes/media.ts:308-310 excludes it under SQLite's binary UTF-8 ordering because supplementary code points sort after U+FFFF. The newly allowed tag can therefore disappear from autocomplete while the user types its prefix; use a prefix query that spans the full Unicode range.
Useful? React with 👍 / 👎.
Chinese media tags and document categories were rejected by Korean/ASCII-only validation. Accept Unicode Han characters in the frontend, API, batch operations, category ACL administration and MCP while retaining existing character and size restrictions. Update localized input guidance.
Validation: server/client typechecks, i18n tests and full production build pass. Direct sanitizer checks cover simplified/traditional and supplementary Han, mixed scripts, deduplication, array/JSON/comma input, limits and unsafe-character rejection.