From 1036a16180c2f9aa68e9d3c6717ed2af32aaab2b Mon Sep 17 00:00:00 2001 From: Andrew Azores Date: Wed, 22 Nov 2023 13:58:11 -0500 Subject: [PATCH] fix(archives): cannot delete archived recording (#176) --- src/main/java/io/cryostat/recordings/RecordingHelper.java | 7 ------- src/main/java/io/cryostat/recordings/Recordings.java | 5 ++--- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/src/main/java/io/cryostat/recordings/RecordingHelper.java b/src/main/java/io/cryostat/recordings/RecordingHelper.java index fef3a5c7d..d549fac9a 100644 --- a/src/main/java/io/cryostat/recordings/RecordingHelper.java +++ b/src/main/java/io/cryostat/recordings/RecordingHelper.java @@ -75,7 +75,6 @@ import jakarta.ws.rs.core.Response; import jakarta.ws.rs.core.Response.ResponseBuilder; import jdk.jfr.RecordingState; -import org.apache.commons.codec.binary.Base32; import org.apache.commons.codec.binary.Base64; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.tuple.Pair; @@ -123,8 +122,6 @@ public class RecordingHelper { @Inject Clock clock; @Inject S3Presigner presigner; - @Inject Base32 base32; - @Inject @Named(Producers.BASE64_URL) Base64 base64Url; @@ -570,10 +567,6 @@ private Optional getArchivedRecordingMetadata(String storageKey) { } } - String decodeBase32(String encoded) { - return new String(base32.decode(encoded), StandardCharsets.UTF_8); - } - String decodeBase64(String encoded) { return new String(base64Url.decode(encoded), StandardCharsets.UTF_8); } diff --git a/src/main/java/io/cryostat/recordings/Recordings.java b/src/main/java/io/cryostat/recordings/Recordings.java index 9cc150323..74e5d2cd8 100644 --- a/src/main/java/io/cryostat/recordings/Recordings.java +++ b/src/main/java/io/cryostat/recordings/Recordings.java @@ -721,11 +721,10 @@ public void deleteRecording(@RestPath long targetId, @RestPath long remoteId) th @DELETE @Blocking - @Path("/api/beta/fs/recordings/{encodedJvmId}/{filename}") + @Path("/api/beta/fs/recordings/{jvmId}/{filename}") @RolesAllowed("write") - public void deleteArchivedRecording(@RestPath String encodedJvmId, @RestPath String filename) + public void deleteArchivedRecording(@RestPath String jvmId, @RestPath String filename) throws Exception { - var jvmId = recordingHelper.decodeBase32(encodedJvmId); logger.infov("Handling archived recording deletion: {0} / {1}", jvmId, filename); var metadata = recordingHelper