From 2b9794451014c04d84023f4d6b0988b01cce18ab Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Tue, 4 May 2021 16:50:29 +0200 Subject: [PATCH] MOBILE-3320 core: Fix localhost images in browser --- src/core/directives/tests/format-text.test.ts | 2 ++ src/core/services/utils/url.ts | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/core/directives/tests/format-text.test.ts b/src/core/directives/tests/format-text.test.ts index e8995972a..d9b2da208 100644 --- a/src/core/directives/tests/format-text.test.ts +++ b/src/core/directives/tests/format-text.test.ts @@ -29,6 +29,7 @@ import { Platform } from '@singletons'; import { mock, mockSingleton, RenderConfig, renderWrapperComponent } from '@/testing/utils'; import { CoreFilter } from '@features/filter/services/filter'; +import { CoreApp } from '@services/app'; describe('CoreFormatTextDirective', () => { @@ -87,6 +88,7 @@ describe('CoreFormatTextDirective', () => { getCurrentSite: () => Promise.resolve(site), }); mockSingleton(CoreFilter, { formatText: (text) => Promise.resolve(text) }); + mockSingleton(CoreApp, { isMobile: () => false }); // Act const fixture = await renderWrapperComponent( diff --git a/src/core/services/utils/url.ts b/src/core/services/utils/url.ts index 3aa8baf33..e9920d1fd 100644 --- a/src/core/services/utils/url.ts +++ b/src/core/services/utils/url.ts @@ -19,6 +19,7 @@ import { CoreTextUtils } from '@services/utils/text'; import { CoreConstants } from '@/core/constants'; import { makeSingleton } from '@singletons'; import { CoreUrl } from '@singletons/url'; +import { CoreApp } from '@services/app'; /* * "Utils" service with helper functions for URLs. @@ -443,7 +444,7 @@ export class CoreUrlUtilsProvider { scheme == 'file' || scheme == 'filesystem' || scheme == CoreConstants.CONFIG.ioswebviewscheme || - (scheme === 'http' && domain === 'localhost'); + (CoreApp.isMobile() && scheme === 'http' && domain === 'localhost'); // @todo: Get served domain from ENV. } /**