@@ -38,28 +38,26 @@ export class AddonModPageHelperProvider {
3838 * @returns The HTML of the page.
3939 */
4040 async getPageHtml ( contents : CoreCourseModuleContentFile [ ] , moduleId : number ) : Promise < string > {
41- let indexUrl : string | undefined ;
41+ let indexFile : CoreCourseModuleContentFile | undefined ;
4242 const paths : Record < string , string > = { } ;
4343
4444 // Extract the information about paths from the module contents.
4545 contents . forEach ( ( content ) => {
46- const url = content . fileurl ;
47-
4846 if ( this . isMainPage ( content ) ) {
4947 // This seems to be the most reliable way to spot the index page.
50- indexUrl = url ;
48+ indexFile = content ;
5149 } else {
5250 let key = content . filename ;
5351 if ( content . filepath !== '/' ) {
5452 // Add the folders without the leading slash.
5553 key = content . filepath . substring ( 1 ) + key ;
5654 }
57- paths [ CoreUrl . decodeURIComponent ( key ) ] = url ;
55+ paths [ CoreUrl . decodeURIComponent ( key ) ] = content . fileurl ;
5856 }
5957 } ) ;
6058
6159 // Promise handling when we are in a browser.
62- if ( ! indexUrl ) {
60+ if ( ! indexFile ) {
6361 // If ever that happens.
6462 throw new CoreError ( 'Could not locate the index page' ) ;
6563 }
@@ -69,14 +67,15 @@ export class AddonModPageHelperProvider {
6967 // The file system is available.
7068 url = await CoreFilepool . downloadUrl (
7169 CoreSites . getCurrentSiteId ( ) ,
72- indexUrl ,
70+ indexFile . fileurl ,
7371 false ,
7472 ADDON_MOD_PAGE_COMPONENT ,
7573 moduleId ,
74+ indexFile . timemodified ,
7675 ) ;
7776 } else {
7877 // We return the live URL.
79- url = await CoreSites . getCurrentSite ( ) ?. checkAndFixPluginfileURL ( indexUrl ) || '' ;
78+ url = await CoreSites . getCurrentSite ( ) ?. checkAndFixPluginfileURL ( indexFile . fileurl ) || '' ;
8079 }
8180
8281 const content = await CoreWS . getText ( url ) ;
0 commit comments