115427: Fixed delete item not redirecting when having some virtual metadata that needs to be copied

This commit is contained in:
Alexandre Vryghem
2024-05-27 16:09:35 +02:00
parent 249cac4f27
commit b8d9c650f5
2 changed files with 8 additions and 2 deletions

View File

@@ -198,6 +198,11 @@ describe('DeleteDataImpl', () => {
method: RestRequestMethod.DELETE,
href: 'some-href?copyVirtualMetadata=a&copyVirtualMetadata=b&copyVirtualMetadata=c',
}));
const callback = (rdbService.buildFromRequestUUIDAndAwait as jasmine.Spy).calls.argsFor(0)[1];
callback();
expect(service.invalidateByHref).toHaveBeenCalledWith('some-href');
done();
});
});

View File

@@ -68,15 +68,16 @@ export class DeleteDataImpl<T extends CacheableObject> extends IdentifiableDataS
deleteByHref(href: string, copyVirtualMetadata?: string[]): Observable<RemoteData<NoContent>> {
const requestId = this.requestService.generateRequestId();
let deleteHref: string = href;
if (copyVirtualMetadata) {
copyVirtualMetadata.forEach((id) =>
href += (href.includes('?') ? '&' : '?')
deleteHref += (deleteHref.includes('?') ? '&' : '?')
+ 'copyVirtualMetadata='
+ id,
);
}
const request = new DeleteRequest(requestId, href);
const request = new DeleteRequest(requestId, deleteHref);
if (hasValue(this.responseMsToLive)) {
request.responseMsToLive = this.responseMsToLive;
}