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..1ff416a8b4 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 @@ -97,9 +97,9 @@ public Set 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 = 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()