Fix the bug of automatically appending basepath to image resource. (#24201)
This commit is contained in:
@@ -10,7 +10,7 @@ export default function RoutePrefixHandle() {
|
|||||||
const addPrefixToImg = (e: HTMLImageElement) => {
|
const addPrefixToImg = (e: HTMLImageElement) => {
|
||||||
const url = new URL(e.src)
|
const url = new URL(e.src)
|
||||||
const prefix = url.pathname.slice(0, basePath.length)
|
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
|
url.pathname = basePath + url.pathname
|
||||||
e.src = url.toString()
|
e.src = url.toString()
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user