@@ -121,6 +121,11 @@ export const replaceStaticWithAsset = ({
121121 let staticFullUrl ;
122122 const isStatic = src . startsWith ( '/static/' ) ;
123123 const assetSrc = src . substring ( 0 , src . indexOf ( '"' ) ) ;
124+
125+ // Check if this is a direct /static/filename.ext pattern (should be converted)
126+ // vs /static/images/filename.ext pattern (should NOT be converted)
127+ const isDirectStaticFile = isStatic && ! assetSrc . substring ( 8 ) . includes ( 'images/' ) ;
128+
124129 const staticName = assetSrc . substring ( 8 ) ;
125130 const assetName = parseAssetName ( src ) ;
126131 const displayName = isStatic ? staticName : assetName ;
@@ -133,16 +138,16 @@ export const replaceStaticWithAsset = ({
133138 // set the base URL to an endpoint serving the draft version of an asset by
134139 // its path.
135140 /* istanbul ignore next */
136- if ( isStatic ) {
141+ if ( isStatic && isDirectStaticFile ) {
137142 staticFullUrl = assetSrc . substring ( 1 ) ;
138143 }
139144 } else if ( editorType === 'expandable' ) {
140145 if ( isCorrectAssetFormat ) {
141146 staticFullUrl = `${ lmsEndpointUrl } ${ assetSrc } ` ;
142- } else {
147+ } else if ( isDirectStaticFile ) {
143148 staticFullUrl = `${ lmsEndpointUrl } ${ getRelativeUrl ( { courseId : learningContextId , displayName } ) } ` ;
144149 }
145- } else if ( ! isCorrectAssetFormat ) {
150+ } else if ( ! isCorrectAssetFormat && isDirectStaticFile ) {
146151 staticFullUrl = getRelativeUrl ( { courseId : learningContextId , displayName } ) ;
147152 }
148153 if ( staticFullUrl ) {
0 commit comments