s3_website 2.7.2 → 2.7.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e2174b1c721a918280814791eb070431f786d3f8
4
- data.tar.gz: 1c965e16df25da900f98ee321e89ad861226537b
3
+ metadata.gz: 0d697820d3714dc4f00c997a1424c199d8786691
4
+ data.tar.gz: 9929b4a2e0d951b8bb58556b0aebca80ee36a82c
5
5
  SHA512:
6
- metadata.gz: 7c706f2591058b084e13850a9015a21ecea00e7d7fd67b65a9fbf9c0245b9bbfd0f80289d057b175bee0a11d85214780dba4a8938952a753ebc1dfc9292403da
7
- data.tar.gz: 7a8b141930c0048a0c04c37c3efa2481552bd9fbcc030e74ff7867d0ef4d45e216c28959dfaf7b3b81aa8e0bbbbf908f2fee4b47483deaab610230c1ee300dcd
6
+ metadata.gz: f8c31db585bdc5d527b90dba36a21e73ec8520eb074feab11ba19aef1a6e01dc7b3faba1c209e720dc7cf0b2768c5cebeb1b97fff8314c8e3675ca3f4ea28766
7
+ data.tar.gz: 9057ccc704fcd6a31348b4acb36d85cb7f4e23c5236b5e22f2ae63689b4ba5e2c379ddbb0d5595ca1e1caab2b8a055f885a0d1c9317539cc639aea4b73f21bc3
data/changelog.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  This project uses [Semantic Versioning](http://semver.org).
4
4
 
5
+ ## 2.7.3
6
+
7
+ * Support valid URI characters in max_age glob
8
+
9
+ See <https://github.com/laurilehmijoki/s3_website/issues/140> for discussion.
10
+
5
11
  ## 2.7.2
6
12
 
7
13
  * Fix Windows issue
@@ -1,3 +1,3 @@
1
1
  module S3Website
2
- VERSION = '2.7.2'
2
+ VERSION = '2.7.3'
3
3
  end
@@ -1 +1 @@
1
- 4e379aae6d75790acc76afed21f335cb
1
+ 41d397d8e99913ad389d18409f14dc64
@@ -80,14 +80,16 @@ case class Upload(originalFile: File, uploadType: UploadType)(implicit site: Sit
80
80
  .right.map(respectMostSpecific)
81
81
  .fold(
82
82
  (seconds: Int) => Some(seconds),
83
- (globs: GlobsSeq) =>
84
- globs.find { globAndInt =>
85
- (rubyRuntime evalScriptlet
83
+ (globs: GlobsSeq) => {
84
+ val matchingMaxAge = (glob: String, maxAge: Int) =>
85
+ rubyRuntime.evalScriptlet(
86
86
  s"""|# encoding: utf-8
87
- |File.fnmatch('${globAndInt._1}', '$s3Key')""".stripMargin)
87
+ |File.fnmatch('$glob', "$s3Key")""".stripMargin)
88
88
  .toJava(classOf[Boolean])
89
89
  .asInstanceOf[Boolean]
90
- } map (_._2)
90
+ val fileGlobMatch = globs find Function.tupled(matchingMaxAge)
91
+ fileGlobMatch map (_._2)
92
+ }
91
93
  )
92
94
  }
93
95
  }
@@ -429,7 +429,7 @@ class S3WebsiteSpec extends Specification {
429
429
  }
430
430
  }
431
431
 
432
- "max-age in config" can {
432
+ "max_age in config" can {
433
433
  "be applied to all files" in new BasicSetup {
434
434
  config = "max_age: 60"
435
435
  setLocalFile("index.html")
@@ -437,6 +437,17 @@ class S3WebsiteSpec extends Specification {
437
437
  sentPutObjectRequest.getMetadata.getCacheControl must equalTo("max-age=60")
438
438
  }
439
439
 
440
+ "supports all valid URI characters in the glob setting" in new BasicSetup {
441
+ config = """
442
+ |max_age:
443
+ | "*.html": 90
444
+ """.stripMargin
445
+ val allValidUrlCharacters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~:/?#[]@!$&'()*+,;=" // See http://stackoverflow.com/a/1547940/990356 for discussion
446
+ setLocalFile(s"$allValidUrlCharacters.html")
447
+ push
448
+ sentPutObjectRequest.getMetadata.getCacheControl must equalTo("max-age=90")
449
+ }
450
+
440
451
  "be applied to files that match the glob" in new BasicSetup {
441
452
  config = """
442
453
  |max_age:
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: s3_website
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.7.2
4
+ version: 2.7.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lauri Lehmijoki
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-04 00:00:00.000000000 Z
11
+ date: 2015-01-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor