Skip to content

Commit 7d7b6d9

Browse files
authored
ZCU-data/fix-allzip-downloading-for-anonymous-use (#1228)
* do not use dtoken when there is anonymous user * added missing ngOnInit
1 parent aa8320c commit 7d7b6d9

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

src/app/bitstream-page/clarin-zip-download-page/clarin-zip-download-page.component.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,15 @@ export class ClarinZipDownloadPageComponent extends ClarinBitstreamDownloadPageC
7171
this.bitstreams$.next([...current, ...bitstreamsRD.payload.page]);
7272
this.bitstreamRD$ = createSuccessfulRemoteDataObject$(this.bitstreams$.getValue()[0]);
7373
this.dtoken = isUndefined(this.route.snapshot.queryParams.dtoken) ? null : this.route.snapshot.queryParams.dtoken;
74-
this.zipDownloadLink.next(this.halService.getRootHref() +
75-
`/core/items/${itemRD.payload.uuid}/allzip?handleId=${itemRD?.payload?.handle}&dtoken=${this.dtoken}`);
74+
const baseUrl = this.halService.getRootHref() +
75+
76+
`/core/items/${itemRD.payload.uuid}/allzip?handleId=${itemRD?.payload?.handle}`;
77+
78+
// Do not add `dtoken` into the URL if it is null
79+
80+
const dtokenParam = this.dtoken ? `&dtoken=${this.dtoken}` : '';
81+
82+
this.zipDownloadLink.next(baseUrl + dtokenParam);
7683
super.ngOnInit();
7784
}
7885
});

0 commit comments

Comments
 (0)