MOBILE-3320 core: Fix localhost images in browser

main
Dani Palou 2021-05-04 16:50:29 +02:00
parent f1f3953749
commit 2b97944510
2 changed files with 4 additions and 1 deletions

View File

@ -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(

View File

@ -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.
}
/**