This repository was archived by the owner on Jul 30, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
plugins/plugin-client-common/src/components/Content/Markdown/components Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -33,16 +33,18 @@ function allContentIsRemote(props: Props): boolean {
33
33
function handleImage ( mdprops : Props , props : ImgProps , key ?: string ) {
34
34
let { src } = props
35
35
36
- const isHttp = / ^ h t t p / i. test ( src )
36
+ const baseUrlIsHttp = mdprops . baseUrl && / h t t p / i. test ( mdprops . baseUrl )
37
+ const srcIsHttp = / ^ h t t p / i. test ( src )
38
+ const isHttp = srcIsHttp || baseUrlIsHttp
37
39
const isLocal = ! isHttp && ! allContentIsRemote ( mdprops )
40
+
38
41
if ( isLocal ) {
39
42
const absoluteSrc = isAbsolute ( src )
40
43
? src
41
44
: join ( mdprops . fullpath ? dirname ( mdprops . fullpath ) : mdprops . baseUrl || process . cwd ( ) , src )
42
45
src = absoluteSrc
43
- } else if ( ! isHttp && mdprops . baseUrl ) {
44
- // then this is a relative path against
45
- src = `${ mdprops . baseUrl } ${ ! / \/ $ / . test ( mdprops . baseUrl ) ? '/' : '' } ${ src } `
46
+ } else if ( ! srcIsHttp && mdprops . baseUrl ) {
47
+ src = mdprops . baseUrl . replace ( / { f i l e n a m e } / g, src )
46
48
}
47
49
48
50
const style = props && props . align ? { float : props . align } : undefined
You can’t perform that action at this time.
0 commit comments