Update index.js

判断 github 链接不为 http(s):// 开头时添加 https:// 前缀
pull/126/head
Mankin 2024-03-18 17:25:29 +08:00 committed by GitHub
parent c0446055aa
commit 24f4bf2719
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 1 deletions

View File

@ -129,7 +129,7 @@ function httpHandler(req, pathname) {
if (!flag) {
return new Response("blocked", {status: 403})
}
if (urlStr.startsWith('github') || urlStr.startsWith('raw.github') || urlStr.startsWith('gist.github')) {
if (urlStr.search(/^https?:\/\//) !== 0) {
urlStr = 'https://' + urlStr
}
const urlObj = newUrl(urlStr)