Skip to content

Commit

Permalink
restapi: fix hrefs in single GET disksnapshot request
Browse files Browse the repository at this point in the history
Fixing GET api/disks/{diskid}/disksnapshots/{snapshotid}:
Correct href for <parent> and <disk> elements.
1. <disk> element was returned without href attribute
2. <parent> element had an incorrect href - buildParentHref() was
used, although the element is not related to the parent entity
resource, but rather represents the parent image of the snapshot.

Bug-Url: https://bugzilla.redhat.com/2013697
  • Loading branch information
mkemel authored and ahadas committed Apr 24, 2022
1 parent edb9cdd commit 0422d91
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@ public DiskSnapshot get() {
new IdQueryParameters(guid), Disk.class);
diskSnapshot.setDisk(new Disk());
diskSnapshot.getDisk().setId(diskId.toString());
diskSnapshot.getDisk().setHref(backendDiskSnapshotsResource.buildParentHref(diskId.toString(), false));
diskSnapshot.setHref(backendDiskSnapshotsResource.buildHref(diskId.toString(), diskSnapshot.getId().toString()));
if (diskSnapshot.getParent() != null) {
diskSnapshot.getParent().setHref(backendDiskSnapshotsResource.buildParentHref(diskId.toString(), true));
diskSnapshot.getParent().setHref(backendDiskSnapshotsResource.buildHref(diskId.toString(),
diskSnapshot.getParent().getId()));
}
return diskSnapshot;
}
Expand Down

0 comments on commit 0422d91

Please sign in to comment.