Skip to content

Commit

Permalink
Merge branch 'master' into alternativeSubmitted
Browse files Browse the repository at this point in the history
  • Loading branch information
pahjbo committed Nov 21, 2024
2 parents a80d374 + f4d44c3 commit 099e9d5
Showing 1 changed file with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,7 @@ private Set<String> listResourceFilesInDir(String dir) throws IOException {
|| string.endsWith(".png")
|| string.endsWith(".jpg")
|| string.endsWith(".jpeg")
|| string.endsWith(".eps")
)
.collect(Collectors.toSet());
}
Expand Down Expand Up @@ -630,14 +631,23 @@ private void checkFileUpload(FileUpload fileUpload)
throw new WebApplicationException("Uploads require the correct file extension");
}

// mime types aren't very well-defined so we include octect-stream as a coverall for .bib
// extensions, and postscript as a coverall for .eps extensions.

switch (contentType) {
//.bib, .png, or .jpg (.jpeg) only; notice .bib may have 'application/octet-stream' type
//.bib, .png, .jpg (.jpeg), .eps only
case "application/octet-stream":
case "application/x-bibtex":
case "application/postscript":
case "image/jpeg":
case "image/png":
if (!extension.equals("bib") && !extension.equals("jpeg") &&
!extension.equals("jpg") && !extension.equals("png"))
case "image/x-eps":
if (!extension.equals("bib") &&
!extension.equals("jpeg") &&
!extension.equals("jpg") &&
!extension.equals("png") &&
!extension.equals("eps")
)
throw new WebApplicationException("Invalid file extension");
break;
default:
Expand Down

0 comments on commit 099e9d5

Please sign in to comment.