diff --git a/moodle.config.json b/moodle.config.json index 13f142090..8ffef01a4 100644 --- a/moodle.config.json +++ b/moodle.config.json @@ -109,5 +109,6 @@ "short": 2000, "long": 3500, "sticky": 0 - } + }, + "disableTokenFile": false } diff --git a/src/core/services/utils/url.ts b/src/core/services/utils/url.ts index 15ef3c685..b429d2ec3 100644 --- a/src/core/services/utils/url.ts +++ b/src/core/services/utils/url.ts @@ -118,7 +118,7 @@ export class CoreUrlUtilsProvider { canUseTokenPluginFile(url: string, siteUrl: string, accessKey?: string): boolean { // Do not use tokenpluginfile if site doesn't use slash params, the URL doesn't work. // Also, only use it for "core" pluginfile endpoints. Some plugins can implement their own endpoint (like customcert). - return !!accessKey && !url.match(/[&?]file=/) && ( + return !CoreConstants.CONFIG.disableTokenFile && !!accessKey && !url.match(/[&?]file=/) && ( url.indexOf(CoreText.concatenatePaths(siteUrl, 'pluginfile.php')) === 0 || url.indexOf(CoreText.concatenatePaths(siteUrl, 'webservice/pluginfile.php')) === 0); } diff --git a/src/types/config.d.ts b/src/types/config.d.ts index a3b66651b..4a32cb29a 100644 --- a/src/types/config.d.ts +++ b/src/types/config.d.ts @@ -73,4 +73,5 @@ export interface EnvironmentConfig { toastDurations: Record; disableCallWSInBackground?: boolean; // If true, disable calling WS in background. callWSInBackgroundExpirationTime?: number; // Ms to consider an entry expired when calling WS in background. Default: 1 week. + disableTokenFile: boolean; // Disable the use of tokenpluginfile.php for downloading files (so it fallbacks to pluginfile.php) }