diff --git a/src/app/core/services/hard-redirect.service.spec.ts b/src/app/core/services/hard-redirect.service.spec.ts deleted file mode 100644 index f060143e65..0000000000 --- a/src/app/core/services/hard-redirect.service.spec.ts +++ /dev/null @@ -1,57 +0,0 @@ -import { HardRedirectService } from './hard-redirect.service'; -import { environment } from '../../../environments/environment'; -import { TestBed } from '@angular/core/testing'; -import { Injectable } from '@angular/core'; - -const requestOrigin = 'http://dspace-angular-ui.dspace.com'; - -describe('HardRedirectService', () => { - let service: TestHardRedirectService; - - beforeEach(() => { - TestBed.configureTestingModule({ providers: [TestHardRedirectService] }); - service = TestBed.inject(TestHardRedirectService); - }); - - describe('when calling rewriteDownloadURL', () => { - let originalValue; - const relativePath = '/test/url/path'; - const testURL = environment.rest.baseUrl + relativePath; - beforeEach(() => { - originalValue = environment.rewriteDownloadUrls; - }); - - it('it should return the same url when rewriteDownloadURL is false', () => { - environment.rewriteDownloadUrls = false; - expect(service.rewriteDownloadURL(testURL)).toEqual(testURL); - }); - - it('it should replace part of the url when rewriteDownloadURL is true', () => { - environment.rewriteDownloadUrls = true; - expect(service.rewriteDownloadURL(testURL)).toEqual(requestOrigin + environment.rest.nameSpace + relativePath); - }); - - afterEach(() => { - environment.rewriteDownloadUrls = originalValue; - }); - }); -}); - -@Injectable() -class TestHardRedirectService extends HardRedirectService { - constructor() { - super(); - } - - redirect(url: string) { - return undefined; - } - - getCurrentRoute() { - return undefined; - } - - getRequestOrigin() { - return requestOrigin; - } -} diff --git a/src/app/core/services/hard-redirect.service.ts b/src/app/core/services/hard-redirect.service.ts index a09521dae5..730101701f 100644 --- a/src/app/core/services/hard-redirect.service.ts +++ b/src/app/core/services/hard-redirect.service.ts @@ -1,6 +1,4 @@ import { Injectable } from '@angular/core'; -import { environment } from '../../../environments/environment'; -import { URLCombiner } from '../url-combiner/url-combiner'; /** * Service to take care of hard redirects @@ -26,15 +24,4 @@ export abstract class HardRedirectService { * Get the hostname of the request */ abstract getRequestOrigin(); - - public rewriteDownloadURL(originalUrl: string): string { - if (environment.rewriteDownloadUrls) { - const hostName = this.getRequestOrigin(); - const namespace = environment.rest.nameSpace; - const rewrittenUrl = new URLCombiner(hostName, namespace).toString(); - return originalUrl.replace(environment.rest.baseUrl, rewrittenUrl); - } else { - return originalUrl; - } - } } diff --git a/src/config/global-config.interface.ts b/src/config/global-config.interface.ts index 8ca11e4a8c..d46822eb61 100644 --- a/src/config/global-config.interface.ts +++ b/src/config/global-config.interface.ts @@ -24,7 +24,6 @@ export interface GlobalConfig extends Config { notifications: INotificationBoardOptions; submission: SubmissionConfig; universal: UniversalConfig; - logDirectory: string; debug: boolean; defaultLanguage: string; languages: LangConfig[]; @@ -32,6 +31,5 @@ export interface GlobalConfig extends Config { item: ItemPageConfig; collection: CollectionPageConfig; themes: ThemeConfig[]; - rewriteDownloadUrls: boolean; mediaViewer: MediaViewerConfig; } diff --git a/src/environments/environment.common.ts b/src/environments/environment.common.ts index 747364d16d..a7957e9fe1 100644 --- a/src/environments/environment.common.ts +++ b/src/environments/environment.common.ts @@ -148,8 +148,6 @@ export const environment: GlobalConfig = { async: true, time: false }, - // Log directory - logDirectory: '.', // NOTE: will log all redux actions and transfers in console debug: false, // Default Language in which the UI will be rendered if the user's browser language is not an active language @@ -280,8 +278,6 @@ export const environment: GlobalConfig = { name: 'dspace' }, ], - // Whether the UI should rewrite file download URLs to match its domain. Only necessary to enable when running UI and REST API on separate domains - rewriteDownloadUrls: false, // Whether to enable media viewer for image and/or video Bitstreams (i.e. Bitstreams whose MIME type starts with "image" or "video"). // For images, this enables a gallery viewer where you can zoom or page through images. // For videos, this enables embedded video streaming diff --git a/src/environments/mock-environment.ts b/src/environments/mock-environment.ts index 3f1ca374e9..cfe160389f 100644 --- a/src/environments/mock-environment.ts +++ b/src/environments/mock-environment.ts @@ -126,8 +126,6 @@ export const environment: Partial = { async: true, time: false }, - // Log directory - logDirectory: '.', // NOTE: will log all redux actions and transfers in console debug: false, // Default Language in which the UI will be rendered if the user's browser language is not an active language