From 4cd966bb9d0864e9f314ff80c0d7200de0ab09a4 Mon Sep 17 00:00:00 2001 From: Mark Patton Date: Fri, 22 Nov 2024 13:31:37 -0500 Subject: [PATCH] Make sure that file resources have a filename so the extension can be checked --- .../pass/deposit/assembler/AbstractAssembler.java | 2 +- .../eclipse/pass/deposit/assembler/PassFileResource.java | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/pass-deposit-services/deposit-core/src/main/java/org/eclipse/pass/deposit/assembler/AbstractAssembler.java b/pass-deposit-services/deposit-core/src/main/java/org/eclipse/pass/deposit/assembler/AbstractAssembler.java index 58d6ea64..16d6ef41 100644 --- a/pass-deposit-services/deposit-core/src/main/java/org/eclipse/pass/deposit/assembler/AbstractAssembler.java +++ b/pass-deposit-services/deposit-core/src/main/java/org/eclipse/pass/deposit/assembler/AbstractAssembler.java @@ -233,7 +233,7 @@ protected List resolveCustodialResources(List } else if (Objects.nonNull(dfr.getDepositFile().getPassFileId())) { String passFileId = dfr.getDepositFile().getPassFileId(); LOG.trace("Returning PassFileResource for Pass File {}", passFileId); - delegateResource = new PassFileResource(passClient, passFileId); + delegateResource = new PassFileResource(passClient, passFileId, dfr.getDepositFile().getName()); } else if (location.startsWith(HTTP_PREFIX) || location.startsWith(HTTPS_PREFIX) || location.startsWith(JAR_PREFIX)) { try { diff --git a/pass-deposit-services/deposit-core/src/main/java/org/eclipse/pass/deposit/assembler/PassFileResource.java b/pass-deposit-services/deposit-core/src/main/java/org/eclipse/pass/deposit/assembler/PassFileResource.java index 15b81e3d..170f2744 100644 --- a/pass-deposit-services/deposit-core/src/main/java/org/eclipse/pass/deposit/assembler/PassFileResource.java +++ b/pass-deposit-services/deposit-core/src/main/java/org/eclipse/pass/deposit/assembler/PassFileResource.java @@ -29,10 +29,12 @@ public class PassFileResource extends AbstractResource { private final PassClient passClient; private final String passFileId; + private final String filename; - public PassFileResource(PassClient passClient, String passFileId) { + public PassFileResource(PassClient passClient, String passFileId, String filename) { this.passClient = passClient; this.passFileId = passFileId; + this.filename = filename; } @Override @@ -54,4 +56,9 @@ public String getContentAsString(Charset charset) throws IOException { public String getDescription() { return "PassFileResource File ID: " + passFileId; } + + @Override + public String getFilename() { + return filename; + } }