fix(tags): categorizeTags 防禦 null/非字串 name 項目
對 null/非物件 tag 與非字串 name 一律歸為 skip,避免存取 tag.name 或比對時出錯。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
0e16c89367
commit
8b92e9739c
+4
-2
@@ -18,10 +18,12 @@ export function categorizeTags(tags, releaseTagNames) {
|
|||||||
const keep = new Set(releaseTagNames)
|
const keep = new Set(releaseTagNames)
|
||||||
|
|
||||||
return tags.map((tag) => {
|
return tags.map((tag) => {
|
||||||
if (isEmptyOrNull(tag.name)) {
|
// 防禦 null/非物件 tag 與非字串 name:一律歸為 skip,避免後續存取或比對時出錯。
|
||||||
|
const name = tag?.name
|
||||||
|
if (typeof name !== 'string' || isEmptyOrNull(name)) {
|
||||||
return { tag, action: 'skip' }
|
return { tag, action: 'skip' }
|
||||||
}
|
}
|
||||||
if (keep.has(tag.name)) {
|
if (keep.has(name)) {
|
||||||
return { tag, action: 'keep' }
|
return { tag, action: 'keep' }
|
||||||
}
|
}
|
||||||
return { tag, action: 'delete' }
|
return { tag, action: 'delete' }
|
||||||
|
|||||||
Reference in New Issue
Block a user