src/main/scala/s3/website/model/push.scala in s3_website-2.7.2 vs src/main/scala/s3/website/model/push.scala in s3_website-2.7.3
- old
+ new
@@ -78,17 +78,19 @@
def respectMostSpecific(globs: GlobsMap): GlobsSeq = globs.toSeq.sortBy(_._1.length).reverse
intOrGlobs
.right.map(respectMostSpecific)
.fold(
(seconds: Int) => Some(seconds),
- (globs: GlobsSeq) =>
- globs.find { globAndInt =>
- (rubyRuntime evalScriptlet
+ (globs: GlobsSeq) => {
+ val matchingMaxAge = (glob: String, maxAge: Int) =>
+ rubyRuntime.evalScriptlet(
s"""|# encoding: utf-8
- |File.fnmatch('${globAndInt._1}', '$s3Key')""".stripMargin)
+ |File.fnmatch('$glob', "$s3Key")""".stripMargin)
.toJava(classOf[Boolean])
.asInstanceOf[Boolean]
- } map (_._2)
+ val fileGlobMatch = globs find Function.tupled(matchingMaxAge)
+ fileGlobMatch map (_._2)
+ }
)
}
}
/**