Skip to content

Commit 218a1dc

Browse files
committed
Merge branch 'dspace-cris-2025_02_x' into main-cris
2 parents 5c0e068 + 76c61e1 commit 218a1dc

File tree

3 files changed

+46
-2
lines changed

3 files changed

+46
-2
lines changed

server.ts

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,11 @@ export function app() {
255255
*/
256256
server.get('/app/client/health', clientHealthCheck);
257257

258+
/**
259+
* Redirecting old manifest
260+
*/
261+
server.get('/json/iiif/**/manifest', redirectManifest);
262+
258263
/**
259264
* Default sending all incoming requests to ngApp() function, after first checking for a cached
260265
* copy of the page (see cacheCheck())
@@ -721,6 +726,39 @@ function healthCheck(req, res) {
721726
});
722727
}
723728

729+
/*
730+
* The callback function to redirect old manifest
731+
*/
732+
function redirectManifest(req, res) {
733+
console.info('Redirecting old manifest');
734+
const url = req.url;
735+
const regex = /json\/iiif\/([^\/]+\/[^\/]+)(?:\/([^\/]+))?\/manifest/;
736+
const match = url.match(regex);
737+
let handle;
738+
let id;
739+
740+
if (match) {
741+
handle = match[1];
742+
const baseUrl = `${environment.rest.baseUrl}/api/pid/find?id=${handle}`;
743+
axios.get(baseUrl)
744+
.then((response) => {
745+
if (response.status === 200) {
746+
const newUrl = `${environment.rest.baseUrl}/iiif/${response.data.id}/manifest`;
747+
console.info('Manifest found, redirect to ', newUrl);
748+
res.redirect(newUrl);
749+
}
750+
})
751+
.catch((error) => {
752+
res.status(error.response.status).send({
753+
error: error.message
754+
});
755+
});
756+
} else {
757+
res.status(422).send({
758+
error: 'Wrong handle'
759+
});
760+
}
761+
}
724762

725763
// Webpack will replace 'require' with '__webpack_require__'
726764
// '__non_webpack_require__' is a proxy to Node 'require'

src/app/app-routes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ export const APP_ROUTES: Route[] = [
324324
.then((m) => m.ROUTES),
325325
},
326326
{
327-
path: 'luck-search',
327+
path: 'lucky-search',
328328
loadChildren: () => import('./lucky-search/lucky-search-routes')
329329
.then((m) => m.ROUTES),
330330
},

src/app/shared/dso-selector/modal-wrappers/create-item-parent-selector/themed-create-item-parent-selector.component.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
import {
22
Component,
3+
EventEmitter,
34
Input,
5+
Output,
46
} from '@angular/core';
57
import { ThemedComponent } from 'src/app/shared/theme-support/themed.component';
68

9+
import { DSpaceObject } from '../../../../core/shared/dspace-object.model';
710
import { CreateItemParentSelectorComponent } from './create-item-parent-selector.component';
811

912
/**
@@ -19,8 +22,11 @@ import { CreateItemParentSelectorComponent } from './create-item-parent-selector
1922
export class ThemedCreateItemParentSelectorComponent
2023
extends ThemedComponent<CreateItemParentSelectorComponent> {
2124
@Input() entityType: string;
25+
@Input() emitOnly: boolean;
2226

23-
protected inAndOutputNames: (keyof CreateItemParentSelectorComponent & keyof this)[] = ['entityType'];
27+
@Output() select: EventEmitter<DSpaceObject> = new EventEmitter<DSpaceObject>();
28+
29+
protected inAndOutputNames: (keyof CreateItemParentSelectorComponent & keyof this)[] = ['entityType', 'select', 'emitOnly'];
2430

2531
protected getComponentName(): string {
2632
return 'CreateItemParentSelectorComponent';

0 commit comments

Comments
 (0)