Fix: replace deprecated String.prototype.substr with slice (#23915)

Signed-off-by: Yongtao Huang <yongtaoh2022@gmail.com>
Co-authored-by: Yongtao Huang <99629139+hyongtao-db@users.noreply.github.com>
This commit is contained in:
Yongtao Huang
2025-08-14 13:47:23 +08:00
committed by GitHub
parent c39dfad7b6
commit 2476511368
3 changed files with 3 additions and 3 deletions

View File

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