@@ -14,7 +14,6 @@ import { FeatureID } from '@dspace/core/data/feature-authorization/feature-id';
1414import { ItemDataService } from '@dspace/core/data/item-data.service' ;
1515import { JsonPatchOperationPathCombiner } from '@dspace/core/json-patch/builder/json-patch-operation-path-combiner' ;
1616import { JsonPatchOperationsBuilder } from '@dspace/core/json-patch/builder/json-patch-operations-builder' ;
17- import { Bitstream } from '@dspace/core/shared/bitstream.model' ;
1817import { followLink } from '@dspace/core/shared/follow-link-config.model' ;
1918import { HALEndpointService } from '@dspace/core/shared/hal-endpoint.service' ;
2019import { Item } from '@dspace/core/shared/item.model' ;
@@ -47,10 +46,12 @@ import {
4746 filter ,
4847 map ,
4948 switchMap ,
49+ take ,
5050} from 'rxjs/operators' ;
5151
52+ import { HardRedirectService } from '../../../../core/services/hard-redirect.service' ;
53+ import { FileService } from '../../../../core/shared/file.service' ;
5254import { BtnDisabledDirective } from '../../../../shared/btn-disabled.directive' ;
53- import { ThemedFileDownloadLinkComponent } from '../../../../shared/file-download-link/themed-file-download-link.component' ;
5455import { FormService } from '../../../../shared/form/form.service' ;
5556import { SubmissionService } from '../../../submission.service' ;
5657import { SectionUploadService } from '../section-upload.service' ;
@@ -69,7 +70,6 @@ import { SubmissionSectionUploadFileViewComponent } from './view/section-upload-
6970 AsyncPipe ,
7071 BtnDisabledDirective ,
7172 SubmissionSectionUploadFileViewComponent ,
72- ThemedFileDownloadLinkComponent ,
7373 TranslateModule ,
7474 ] ,
7575} )
@@ -229,6 +229,8 @@ export class SubmissionSectionUploadFileComponent implements OnChanges, OnInit,
229229 private operationsService : SubmissionJsonPatchOperationsService ,
230230 private submissionService : SubmissionService ,
231231 private uploadService : SectionUploadService ,
232+ private fileService : FileService ,
233+ private hardRedirectService : HardRedirectService ,
232234 private authorizationService : AuthorizationDataService ,
233235 private halService : HALEndpointService ,
234236 private itemDataService : ItemDataService ,
@@ -337,13 +339,11 @@ export class SubmissionSectionUploadFileComponent implements OnChanges, OnInit,
337339 }
338340
339341 /**
340- * Build a Bitstream object by the current file uuid
341- *
342- * @return Bitstream object
342+ * Download the file using a short-lived token
343343 */
344- public getBitstream ( ) : Bitstream {
345- return Object . assign ( new Bitstream ( ) , {
346- uuid : this . fileData . uuid ,
344+ public downloadFile ( ) {
345+ this . fileService . retrieveFileDownloadLink ( this . fileData . url ) . pipe ( take ( 1 ) ) . subscribe ( ( link ) => {
346+ window . open ( link , '_blank' ) ;
347347 } ) ;
348348 }
349349
0 commit comments