MOBILE-4098 siteplugins: Restore style URLs behaviour

main
Dani Palou 2022-06-16 10:36:25 +02:00 committed by Pau Ferrer Ocaña
parent c1afc4b614
commit 848932d527
1 changed files with 7 additions and 3 deletions

View File

@ -84,7 +84,8 @@ import { CoreContentLinksModuleIndexHandler } from '@features/contentlinks/class
import { CoreContentLinksDelegate } from '@features/contentlinks/services/contentlinks-delegate';
import { CoreContentLinksModuleListHandler } from '@features/contentlinks/classes/module-list-handler';
import { CoreObject } from '@singletons/object';
import { CoreUrl } from '@singletons/url';
import { CoreUrlUtils } from '@services/utils/url';
import { CoreText } from '@singletons/text';
const HANDLER_DISABLED = 'core_site_plugins_helper_handler_disabled';
@ -164,8 +165,11 @@ export class CoreSitePluginsHelperProvider {
): Promise<string> {
const site = await CoreSites.getSite(siteId);
// Make sure it's an absolute URL.
let url = handlerSchema.styles?.url ? CoreUrl.toAbsoluteURL(site.getURL(), handlerSchema.styles.url) : undefined;
// Make sure it's an absolute URL. Do not use toAbsoluteURL because it can change the behaviour and break plugin styles.
let url = handlerSchema.styles?.url;
if (url && !CoreUrlUtils.isAbsoluteURL(url)) {
url = CoreText.concatenatePaths(site.getURL(), url);
}
if (url && handlerSchema.styles?.version) {
// Add the version to the URL to prevent getting a cached file.