Skip to content

Commit

Permalink
Revert "Cleanse API input params"
Browse files Browse the repository at this point in the history
This reverts commit d05660f
  • Loading branch information
rpoet-jh committed Dec 19, 2024
1 parent 71f20e0 commit 4e2fa53
Showing 1 changed file with 2 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,11 @@ public ResponseEntity<?> fileUpload(@RequestParam("file") MultipartFile file, Pr
@ResponseBody
public ResponseEntity<?> getFileById(@PathVariable("uuid") String uuid,
@PathVariable("origFileName") String origFileName) {
String fileId = uuid + "/" + origFileName;
if (StringUtils.isEmpty(uuid) || StringUtils.isEmpty(origFileName)) {
LOG.error("File ID not provided to get a file.");
return ResponseEntity.badRequest().body("File ID not provided to get a file.");
}
String cleansedUuid = StringUtils.normalizeSpace(uuid);
String cleansedOrigFileName = StringUtils.normalizeSpace(origFileName);
String fileId = cleansedUuid + "/" + cleansedOrigFileName;

ByteArrayResource fileResource;
String contentType = "";

Expand Down Expand Up @@ -144,9 +141,7 @@ public ResponseEntity<?> deleteFileById(@PathVariable("uuid") String uuid,
@PathVariable("origFileName") String origFileName,
Principal principal, HttpServletRequest request) {
String principalName = principal.getName();
String cleansedUuid = StringUtils.normalizeSpace(uuid);
String cleansedOrigFileName = StringUtils.normalizeSpace(origFileName);
String fileId = cleansedUuid + "/" + cleansedOrigFileName;
String fileId = uuid + "/" + origFileName;

//Get the file, check that it exists, and then check if current user has permissions to delete
try {
Expand Down

0 comments on commit 4e2fa53

Please sign in to comment.