Skip to content

Commit 418025f

Browse files
committed
use the more robust and shared isExternal function
1 parent 8c8b9f4 commit 418025f

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/core/fetch/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ function qualifyURL(url) {
2929
return url;
3030
}
3131

32-
function isExternal(url) {
32+
export function isExternal(url) {
3333
url = qualifyURL(url);
3434
url = new URL(url);
3535
return url.origin !== location.origin;

src/core/render/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { getPath, isAbsolutePath } from '../router/util';
99
import { isMobile, inBrowser } from '../util/env';
1010
import { isPrimitive } from '../util/core';
1111
import { scrollActiveSidebar } from '../event/scroll';
12+
import { isExternal } from '../fetch';
1213
import { Compiler } from './compiler';
1314
import * as tpl from './tpl';
1415
import { prerenderEmbed } from './embed';
@@ -259,10 +260,9 @@ export function initRender(vm) {
259260

260261
if (config.logo) {
261262
const isBase64 = /^data:image/.test(config.logo);
262-
const isExternal = /(?:http[s]?:)?\/\//.test(config.logo);
263263
const isRelative = /^\./.test(config.logo);
264264

265-
if (!isBase64 && !isExternal && !isRelative) {
265+
if (!isBase64 && !isExternal(config.logo) && !isRelative) {
266266
config.logo = getPath(vm.router.getBasePath(), config.logo);
267267
}
268268
}

0 commit comments

Comments
 (0)