Skip to content

Commit 1a95fb0

Browse files
committed
add comment
1 parent cdb5148 commit 1a95fb0

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

src/commons/commonFuncs.js

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,22 @@ export function GetBaseUrl() {
2222
export function newGuid() {
2323
return uuidv4();
2424
}
25-
25+
/**
26+
*getImgSrc for both normal hosting and Reverse proxy
27+
*
28+
* @export
29+
* @param {string} url the relative image url
30+
* @returns real url
31+
*/
2632
export function getImgSrc(url) {
2733
if (typeof url !== 'string') return url;
2834
const base = GetBaseUrl();
2935

30-
if (!base || base === '/') return url;
31-
32-
if (url.indexOf(base) >= 0) return url;
33-
34-
return `${base}/${url}`;
36+
return !base || base === '/' || url.indexOf(base) >= 0
37+
? url
38+
: `${base}/${url}`;
3539
}
40+
3641
/**
3742
*Merge second array to first array if existed then update.
3843
*

0 commit comments

Comments
 (0)