diff --git a/src/main/scala/s3/website/model/push.scala b/src/main/scala/s3/website/model/push.scala index 4e7a44cb..1e37f15d 100644 --- a/src/main/scala/s3/website/model/push.scala +++ b/src/main/scala/s3/website/model/push.scala @@ -84,7 +84,7 @@ case class Upload(originalFile: File, uploadType: UploadType)(implicit site: Sit val matchingMaxAge = (glob: String, maxAge: Int) => rubyRuntime.evalScriptlet( s"""|# encoding: utf-8 - |File.fnmatch('$glob', '$s3Key')""".stripMargin) + |File.fnmatch('$glob', "$s3Key")""".stripMargin) .toJava(classOf[Boolean]) .asInstanceOf[Boolean] val fileGlobMatch = globs find Function.tupled(matchingMaxAge) diff --git a/src/test/scala/s3/website/S3WebsiteSpec.scala b/src/test/scala/s3/website/S3WebsiteSpec.scala index 63a813e6..7bed8c92 100644 --- a/src/test/scala/s3/website/S3WebsiteSpec.scala +++ b/src/test/scala/s3/website/S3WebsiteSpec.scala @@ -437,6 +437,17 @@ class S3WebsiteSpec extends Specification { sentPutObjectRequest.getMetadata.getCacheControl must equalTo("max-age=60") } + "supports all valid URI characters in the glob setting" in new BasicSetup { + config = """ + |max_age: + | "*.html": 90 + """.stripMargin + val allValidUrlCharacters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~:/?#[]@!$&'()*+,;=" // See http://stackoverflow.com/a/1547940/990356 for discussion + setLocalFile(s"$allValidUrlCharacters.html") + push + sentPutObjectRequest.getMetadata.getCacheControl must equalTo("max-age=90") + } + "be applied to files that match the glob" in new BasicSetup { config = """ |max_age: