Skip to content

Commit

Permalink
Amend the check on IllegalAttachmentFileNameException
Browse files Browse the repository at this point in the history
  • Loading branch information
bhou committed May 7, 2024
1 parent f53744c commit d8e8275
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ public Set<URI> saveAttachments(

if (filename != null) {
if ((filename.contains("/") || filename.contains("\\")
|| filename.equals(".") || filename.equals(".."))) {
|| filename.equals(".") || filename.contains(".."))) {
throw new IllegalAttachmentFileNameException("Attachment filename " + filename + " is illegal. "
+ "Filenames should not be . or .., or contain /, \\.");
+ "Filenames should not be ., or contain .., /, \\.");
}

final String attachmentCanonicalPath =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ class LocalFileSystemAttachmentServiceImplSpec extends Specification {
thrown(IllegalAttachmentFileNameException)
}
def "reject attachments with illegal filename is .."() {
def "reject attachments with illegal filename containing .."() {
Set<Resource> attachments = new HashSet<Resource>()
Resource attachment = Mockito.mock(Resource.class)
Mockito.doReturn("..").when(attachment).getFilename()
Expand Down

0 comments on commit d8e8275

Please # to comment.