Matching a directory breaks the example config
geelen opened this issue · comments
Given the following config:
return gulp.src("release/**")
.pipe($.awspublishRouter({
cache: {
cacheTime: 86400 // Cache for 1 day by default
},
routes: {
// Passthrough everything else
"^.+$": "$&"
}
}))
You get an explosion, because the first file is current/path/release/
, which returns a path.relative
of ''
. That doesn't match the passthrough regexp, you need "^.*$": "$&"
to match the empty string.
Also, the explosion could have a much better error message - right now you get a missing property routeMatcher on undefined, but it's simply that the _.find
doesn't find anything. So it seems like a common-enough case.
This library is exactly what I need though, and I absolutely <3 your approach. Had not even considered that a router might be a good fit, but now it seems so simple!
Cheers,
-glen.
Hi Glen, sorry for the wait on this one as well!
So let's see - release/
is a directory, right? There's really no such thing as directories for S3, so I think the best alternative would be to just skip them. This would be pretty simple to implement, since Vinyl instances have an isNull()
method to detect empty files / directories. WDYT?
I have a PR awaiting if you think what I suggested is a workable solution to the problem. :)