Skip to content

Commit e49f730

Browse files
CodFrmCopilot
andauthored
Update src/app/service/service_worker/utils.ts
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 59dcad3 commit e49f730

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/app/service/service_worker/utils.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,10 @@ export function parseUrlSRI(url: string): TUrlSRIInfo {
9595
}
9696
}
9797

98-
// 即使没有解析到任何哈希值,也只会返回空对象而不是 undefined
98+
// 如果没有解析到任何哈希值,则返回 undefined,与类型定义保持一致
99+
if (Object.keys(hash).length === 0) {
100+
return { url: urls[0], hash: undefined, originalUrl: url };
101+
}
99102
return { url: urls[0], hash, originalUrl: url };
100103
}
101104

0 commit comments

Comments
 (0)