From b7bfad7dd40cd2f8760d84dc26af10294792f6bc Mon Sep 17 00:00:00 2001 From: bhou Date: Tue, 7 May 2024 10:44:49 -0700 Subject: [PATCH] Amend the check on IllegalAttachmentFileNameException --- .../web/services/impl/LocalFileSystemAttachmentServiceImpl.java | 2 +- .../impl/LocalFileSystemAttachmentServiceImplSpec.groovy | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/genie-web/src/main/java/com/netflix/genie/web/services/impl/LocalFileSystemAttachmentServiceImpl.java b/genie-web/src/main/java/com/netflix/genie/web/services/impl/LocalFileSystemAttachmentServiceImpl.java index d6cf472412..17bb02f53f 100644 --- a/genie-web/src/main/java/com/netflix/genie/web/services/impl/LocalFileSystemAttachmentServiceImpl.java +++ b/genie-web/src/main/java/com/netflix/genie/web/services/impl/LocalFileSystemAttachmentServiceImpl.java @@ -99,7 +99,7 @@ public Set saveAttachments( if ((filename.contains("/") || filename.contains("\\") || filename.equals(".") || filename.equals(".."))) { throw new IllegalAttachmentFileNameException("Attachment filename " + filename + " is illegal. " - + "Filenames should not be . or .., or contain /, \\."); + + "Filenames should not be ., or contain .., /, \\."); } final String attachmentCanonicalPath = diff --git a/genie-web/src/test/groovy/com/netflix/genie/web/services/impl/LocalFileSystemAttachmentServiceImplSpec.groovy b/genie-web/src/test/groovy/com/netflix/genie/web/services/impl/LocalFileSystemAttachmentServiceImplSpec.groovy index 5cfdc0cd9e..16e855325e 100644 --- a/genie-web/src/test/groovy/com/netflix/genie/web/services/impl/LocalFileSystemAttachmentServiceImplSpec.groovy +++ b/genie-web/src/test/groovy/com/netflix/genie/web/services/impl/LocalFileSystemAttachmentServiceImplSpec.groovy @@ -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 attachments = new HashSet() Resource attachment = Mockito.mock(Resource.class) Mockito.doReturn("..").when(attachment).getFilename()