diff --git a/src/app/bitstream-page/legacy-bitstream-url-redirect.guard.ts b/src/app/bitstream-page/legacy-bitstream-url-redirect.guard.ts index d8d8932c30d..ba995c5e9f4 100644 --- a/src/app/bitstream-page/legacy-bitstream-url-redirect.guard.ts +++ b/src/app/bitstream-page/legacy-bitstream-url-redirect.guard.ts @@ -9,6 +9,7 @@ import { import { Observable } from 'rxjs'; import { map } from 'rxjs/operators'; +import { APP_CONFIG, AppConfig } from '../../config/app-config.interface'; import { PAGE_NOT_FOUND_PATH } from '../app-routing-paths'; import { BitstreamDataService } from '../core/data/bitstream-data.service'; import { RemoteData } from '../core/data/remote-data'; @@ -30,6 +31,7 @@ export const legacyBitstreamURLRedirectGuard: CanActivateFn = ( bitstreamDataService: BitstreamDataService = inject(BitstreamDataService), serverHardRedirectService: HardRedirectService = inject(HardRedirectService), router: Router = inject(Router), + appConfig: AppConfig = inject(APP_CONFIG), ): Observable => { const prefix = route.params.prefix; const suffix = route.params.suffix; @@ -46,7 +48,9 @@ export const legacyBitstreamURLRedirectGuard: CanActivateFn = ( getFirstCompletedRemoteData(), map((rd: RemoteData) => { if (rd.hasSucceeded && !rd.hasNoContent) { - serverHardRedirectService.redirect(new URL(`/bitstreams/${rd.payload.uuid}/download`, serverHardRedirectService.getCurrentOrigin()).href, 301); + const nameSpace = appConfig.ui.nameSpace?.replace(/\/$/, '') || ''; + const redirectUrl = new URL(nameSpace + `/bitstreams/${rd.payload.uuid}/download`, serverHardRedirectService.getCurrentOrigin()).href; + serverHardRedirectService.redirect(redirectUrl, 301); return false; } else { return router.createUrlTree([PAGE_NOT_FOUND_PATH]); diff --git a/src/app/item-page/clarin-files-section/clarin-files-section.component.ts b/src/app/item-page/clarin-files-section/clarin-files-section.component.ts index 15820be9f68..08edfe7ac55 100644 --- a/src/app/item-page/clarin-files-section/clarin-files-section.component.ts +++ b/src/app/item-page/clarin-files-section/clarin-files-section.component.ts @@ -107,8 +107,10 @@ export class ClarinFilesSectionComponent implements OnInit { return file.name; }); - const url = `${this.halService.getRootHref()}/core/items/${this.item.id}/allzip?handleId=${this.itemHandle}`; - this.command = `curl -o "allzip.zip" "${url}"`; + // Generate curl command for individual bitstream downloads + const baseUrl = `${this.halService.getRootHref()}/bitstream/${this.itemHandle}`; + const fileNamesFormatted = fileNames.map((fileName, index) => `/${index}/${fileName}`).join(','); + this.command = `curl -O ${baseUrl}{${fileNamesFormatted}}`; } loadDownloadZipConfigProperties() {