Merge pull request #1065 from atmire/w2p-77583_Issue-3113_Fix-item-handle-redirect

Handle redirect for items not working fix
This commit is contained in:
Tim Donohue
2021-03-30 09:50:05 -05:00
committed by GitHub
2 changed files with 4 additions and 4 deletions

View File

@@ -22,7 +22,7 @@ describe('LookupGuard', () => {
}
};
guard.canActivate(scopedRoute as any, undefined);
expect(dsoService.findByIdAndIDType).toHaveBeenCalledWith('123456789/1234', IdentifierType.HANDLE);
expect(dsoService.findByIdAndIDType).toHaveBeenCalledWith('hdl:123456789/1234', IdentifierType.HANDLE);
});
it('should call findByIdAndIDType with handle params', () => {
@@ -33,7 +33,7 @@ describe('LookupGuard', () => {
}
};
guard.canActivate(scopedRoute as any, undefined);
expect(dsoService.findByIdAndIDType).toHaveBeenCalledWith('123456789%2F1234', IdentifierType.HANDLE);
expect(dsoService.findByIdAndIDType).toHaveBeenCalledWith('hdl:123456789%2F1234', IdentifierType.HANDLE);
});
it('should call findByIdAndIDType with UUID params', () => {

View File

@@ -35,11 +35,11 @@ export class LookupGuard implements CanActivate {
type = IdentifierType.HANDLE;
const prefix = route.params.idType;
const handleId = route.params.id;
id = `${prefix}/${handleId}`;
id = `hdl:${prefix}/${handleId}`;
} else if (route.params.idType === IdentifierType.HANDLE) {
type = IdentifierType.HANDLE;
id = route.params.id;
id = 'hdl:' + route.params.id;
} else {
type = IdentifierType.UUID;