File tree Expand file tree Collapse file tree
src/public/pages/scripts/test Expand file tree Collapse file tree Original file line number Diff line number Diff line change 88 * @returns {{ owner: string, repo: string, number: string } | null } 解析结果
99 */
1010export function parseGithubIssueUrl ( url ) {
11- const match = String ( url ) . match ( / ^ h t t p s : \/ \/ g i t h u b \. c o m \/ ( [ ^ / ] + ) \/ ( [ ^ / ] + ) \/ i s s u e s \/ ( \d + ) $ / )
11+ const match = url . match ( / ^ h t t p s : \/ \/ g i t h u b \. c o m \/ ( [ ^ / ] + ) \/ ( [ ^ / ] + ) \/ i s s u e s \/ ( \d + ) $ / )
1212 if ( ! match ) return null
1313 return { owner : match [ 1 ] , repo : match [ 2 ] , number : match [ 3 ] }
1414}
Original file line number Diff line number Diff line change @@ -117,14 +117,22 @@ function refreshGithubIssueProbes() {
117117 githubIssueInflight . clear ( )
118118}
119119
120+ /**
121+ * 规范化 `fount.test.hubUrl`(去尾斜杠;未设则为空串)。
122+ * @returns {string } hub 基址
123+ */
124+ function getHubUrl ( ) {
125+ return String ( globalThis . fount ?. test ?. hubUrl || '' ) . replace ( / \/ $ / , '' )
126+ }
127+
120128/**
121129 * issue 是否已关闭(成功结果缓存;进行中请求复用;失败退避;无 hub / 超时 → false)。
122130 * @param {string } url 已解析的 issue URL
123131 * @param {{ refresh?: boolean } } [options] `refresh` 为 true 时跳过缓存并重新探测
124132 * @returns {Promise<boolean> } 已关闭为 true
125133 */
126134async function probeGithubIssueClosed ( url , { refresh = false } = { } ) {
127- const hub = String ( globalThis . fount ?. test ?. hubUrl || '' ) . replace ( / \/ $ / , '' )
135+ const hub = getHubUrl ( )
128136 if ( ! hub ) return false
129137
130138 if ( refresh ) {
@@ -318,7 +326,7 @@ async function runLocaleScriptCheck(locale) {
318326 * @returns {Promise<void> } 完成校验
319327 */
320328async function checkAriaIgnores ( { refresh = false , entries = collectAriaIgnoreEntries ( ) } = { } ) {
321- const hub = String ( globalThis . fount ?. test ?. hubUrl || '' ) . replace ( / \/ $ / , '' )
329+ const hub = getHubUrl ( )
322330 /** @type {{ url: string, location: string }[] } */
323331 const toProbe = [ ]
324332 for ( const { url, location, parsed } of entries ) {
You can’t perform that action at this time.
0 commit comments