From c90b1cc8fae873e6c94e6db327bd2bc0db9efaa2 Mon Sep 17 00:00:00 2001 From: milanmajchrak <90026355+milanmajchrak@users.noreply.github.com> Date: Tue, 17 Dec 2024 12:11:29 +0100 Subject: [PATCH] Copied fixes from the lindat branch (#770) * Copied PR 769 * Used root URL to compose download URL with namespace (#768) * Cherry-picked docker compose rest --- docker/docker-compose-rest.yml | 8 ++++++-- src/app/app-routing-paths.ts | 5 +++++ .../clarin-license-agreement-page.component.ts | 8 +++++--- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/docker/docker-compose-rest.yml b/docker/docker-compose-rest.yml index e62da488676..a2f99da6288 100644 --- a/docker/docker-compose-rest.yml +++ b/docker/docker-compose-rest.yml @@ -94,13 +94,16 @@ services: - /bin/bash - '-c' # When customizing the namespace, add the following command to the entrypoint command below (after `while ...`): - # `pushd ../webapps && unlink server && ln -s /dspace/webapps/server/ 'repository#server' && popd` + # `pushd ../webapps && (unlink server || true) && (ln -s /dspace/webapps/server/ 'repository#server' || true) && + # popd` + # The `(... || true)` condition is necessary to ensure the `popd` command runs at the end. + # It used to fail when the `server` folder did not exist in `/webapps`. # This will create a symlink from the webapps directory to the server directory with the custom namespace # (e.g. /dspace/webapps/server -> /dspace/webapps/repository#server) - | while (! /dev/null 2>&1; do sleep 1; done; /dspace/bin/dspace database migrate force - custom_run.sh + ./custom_run.sh /dspace/bin/start-handle-server # DSpace database container dspacedb: @@ -168,6 +171,7 @@ services: cp -r -u /opt/solr/server/solr/configsets/dspace/statistics/* statistics exec solr -p 898${INSTANCE} -f -m 4g volumes: + # Commented out because there are a lot of files in the assetstore assetstore: pgdata: solr_data: diff --git a/src/app/app-routing-paths.ts b/src/app/app-routing-paths.ts index 2ae72bf26d3..8a2e540f70f 100644 --- a/src/app/app-routing-paths.ts +++ b/src/app/app-routing-paths.ts @@ -22,6 +22,11 @@ export function getBitstreamModuleRoute() { export function getBitstreamDownloadRoute(bitstream): string { return new URLCombiner(getBitstreamModuleRoute(), bitstream.uuid, 'download').toString(); } + +export function getBitstreamContentRoute(bitstream): string { + return new URLCombiner(getBitstreamModuleRoute(), bitstream.uuid, 'content').toString(); +} + export function getBitstreamRequestACopyRoute(item, bitstream): { routerLink: string, queryParams: any } { const url = new URLCombiner(getItemModuleRoute(), item.uuid, 'request-a-copy').toString(); return { diff --git a/src/app/bitstream-page/clarin-license-agreement-page/clarin-license-agreement-page.component.ts b/src/app/bitstream-page/clarin-license-agreement-page/clarin-license-agreement-page.component.ts index 6edc55c33d3..fe5e6368593 100644 --- a/src/app/bitstream-page/clarin-license-agreement-page/clarin-license-agreement-page.component.ts +++ b/src/app/bitstream-page/clarin-license-agreement-page/clarin-license-agreement-page.component.ts @@ -35,7 +35,7 @@ import { RemoteDataBuildService } from '../../core/cache/builders/remote-data-bu import { HttpOptions } from '../../core/dspace-rest/dspace-rest.service'; import { Router } from '@angular/router'; import { getItemPageRoute } from '../../item-page/item-page-routing-paths'; -import { getBitstreamDownloadRoute } from '../../app-routing-paths'; +import { getBitstreamContentRoute } from '../../app-routing-paths'; import { hasFailed } from 'src/app/core/data/request-entry-state.model'; import { FindListOptions } from '../../core/data/find-list-options.model'; import isEqual from 'lodash/isEqual'; @@ -255,10 +255,12 @@ export class ClarinLicenseAgreementPageComponent implements OnInit { .subscribe(bitstream$ => { bitstream = bitstream$; }); - let bitstreamDownloadPath = getBitstreamDownloadRoute(bitstream); + let bitstreamDownloadPath = getBitstreamContentRoute(bitstream); if (isNotEmpty(downloadToken)) { - bitstreamDownloadPath = bitstreamDownloadPath + '?dtoken=' + downloadToken; + bitstreamDownloadPath = this.halService.getRootHref() + '/core' + bitstreamDownloadPath + + '?dtoken=' + downloadToken; } + this.hardRedirectService.redirect(bitstreamDownloadPath); }