File tree Expand file tree Collapse file tree
src/editors/sharedComponents/TinyMceWidget Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -85,6 +85,7 @@ export const replaceStaticWithAsset = ({
8585 learningContextId,
8686 editorType,
8787 lmsEndpointUrl,
88+ validateAssetUrl = true ,
8889} ) => {
8990 let content = initialContent ;
9091 let hasChanges = false ;
@@ -126,8 +127,10 @@ export const replaceStaticWithAsset = ({
126127
127128 // check if the asset exists on the server before replacing
128129 try {
129- await getAuthenticatedHttpClient ( )
130- . get ( staticFullUrl ) ;
130+ if ( validateAssetUrl ) {
131+ await getAuthenticatedHttpClient ( )
132+ . get ( staticFullUrl ) ;
133+ }
131134 content = currentContent . replace ( currentSrc , staticFullUrl ) ;
132135 hasChanges = true ;
133136 } catch ( e ) {
Original file line number Diff line number Diff line change @@ -194,7 +194,12 @@ describe('TinyMceEditor hooks', () => {
194194 const lmsEndpointUrl = getConfig ( ) . LMS_BASE_URL ;
195195 it ( 'returns updated src for text editor to update content' , ( ) => {
196196 const expected = `<img src="/${ baseAssetUrl } @soMEImagEURl1.jpeg"/><a href="/${ baseAssetUrl } @test.pdf">test</a><img src="/${ baseAssetUrl } @correct.png" /><img src="/${ baseAssetUrl } @correct.png" />` ;
197- const actual = module . replaceStaticWithAsset ( { initialContent, learningContextId } ) ;
197+ const actual = module . replaceStaticWithAsset ( {
198+ initialContent,
199+ learningContextId,
200+ validateAssetUrl : false ,
201+
202+ } ) ;
198203 expect ( actual ) . toEqual ( expected ) ;
199204 } ) ;
200205 it ( 'returns updated src with absolute url for expandable editor to update content' , ( ) => {
@@ -205,6 +210,7 @@ describe('TinyMceEditor hooks', () => {
205210 editorType,
206211 lmsEndpointUrl,
207212 learningContextId,
213+ validateAssetUrl : false ,
208214 } ) ;
209215 expect ( actual ) . toEqual ( expected ) ;
210216 } ) ;
You can’t perform that action at this time.
0 commit comments