From 892512192b73841c3cef69470e094bf2de4862fd Mon Sep 17 00:00:00 2001 From: Art Lowel Date: Wed, 27 Jan 2021 17:32:15 +0100 Subject: [PATCH] fix issue where private files could no longer be downloaded --- src/app/core/shared/file.service.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/app/core/shared/file.service.ts b/src/app/core/shared/file.service.ts index 2ebe63d528..4c8a63e55f 100644 --- a/src/app/core/shared/file.service.ts +++ b/src/app/core/shared/file.service.ts @@ -1,7 +1,7 @@ import { Inject, Injectable } from '@angular/core'; import { RawRestResponse } from '../dspace-rest/raw-rest-response.model'; import { AuthService } from '../auth/auth.service'; -import { take, map } from 'rxjs/operators'; +import { take, map, tap } from 'rxjs/operators'; import { NativeWindowRef, NativeWindowService } from '../services/window.service'; import { URLCombiner } from '../url-combiner/url-combiner'; import { hasValue } from '../../shared/empty.util'; @@ -23,10 +23,10 @@ export class FileService { * @param url * file url */ - downloadFile(url: string): Observable { - return this.authService.getShortlivedToken().pipe(take(1), map((token) => - hasValue(token) ? new URLCombiner(url, `?authentication-token=${token}`).toString() : url - )); + downloadFile(url: string) { + this.authService.getShortlivedToken().pipe(take(1)).subscribe((token) => { + this._window.nativeWindow.location.href = hasValue(token) ? new URLCombiner(url, `?authentication-token=${token}`).toString() : url; + }); } /**