Skip to content

Commit

Permalink
Make sure that file resources have a filename so the extension can be…
Browse files Browse the repository at this point in the history
… checked
  • Loading branch information
markpatton committed Nov 22, 2024
1 parent b0d8643 commit 4cd966b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ protected List<DepositFileResource> resolveCustodialResources(List<DepositFile>
} 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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
}
}

0 comments on commit 4cd966b

Please sign in to comment.