Fix the bug of automatically appending basepath to image resource. (#24201)

This commit is contained in:
17hz
2025-08-20 23:15:18 +08:00
committed by GitHub
parent d12255025c
commit f0684c1957

View File

@@ -10,7 +10,7 @@ export default function RoutePrefixHandle() {
const addPrefixToImg = (e: HTMLImageElement) => {
const url = new URL(e.src)
const prefix = url.pathname.slice(0, basePath.length)
if (prefix !== basePath && !url.href.startsWith('blob:') && !url.href.startsWith('data:')) {
if (prefix !== basePath && !url.href.startsWith('blob:') && !url.href.startsWith('data:') && !url.href.startsWith('http')) {
url.pathname = basePath + url.pathname
e.src = url.toString()
}