diff --git a/src/core/siteplugins/providers/helper.ts b/src/core/siteplugins/providers/helper.ts index b55378728..2b1242d85 100644 --- a/src/core/siteplugins/providers/helper.ts +++ b/src/core/siteplugins/providers/helper.ts @@ -142,6 +142,11 @@ export class CoreSitePluginsHelperProvider { url = this.textUtils.concatenatePaths(site.getURL(), url); } + if (url && handlerSchema.styles.version) { + // Add the version to the URL to prevent getting a cached file. + url += (url.indexOf('?') != -1 ? '&' : '?') + 'version=' + handlerSchema.styles.version; + } + const uniqueName = this.sitePluginsProvider.getHandlerUniqueName(plugin, handlerName), componentId = uniqueName + '#main'; diff --git a/src/providers/filepool.ts b/src/providers/filepool.ts index 09d873f94..aded3de7e 100644 --- a/src/providers/filepool.ts +++ b/src/providers/filepool.ts @@ -2197,9 +2197,27 @@ export class CoreFilepoolProvider { filename = this.urlUtils.getLastFileWithoutParams(fileUrl); } + // If there are hashes in the URL, extract them. + const index = filename.indexOf('#'); + let hashes; + + if (index != -1) { + hashes = filename.split('#'); + + // Remove the URL from the array. + hashes.shift(); + + filename = filename.substr(0, index); + } + // Remove the extension from the filename. filename = this.mimeUtils.removeExtension(filename); + if (hashes) { + // Add hashes to the name. + filename += '_' + hashes.join('_'); + } + return this.textUtils.removeSpecialCharactersForFiles(filename); }