Closed bkw closed 9 years ago
So my understanding is as follows:
The generated key checks to see if you've specified a prefix; e.g. dest('/foo')
means awsOptions.Key = '/foo'
. Then say gulp sends vinyl file with path /bar/baz
and base of /bar
. Intention was originally to generate foo/baz
. However if no prefix is given then you get the chopping behaviour since it becomes baz
(chopping off the "/"). I believe this is expected in S3 since /
should never be the first character.
Can you give me an example and result that you're seeing? I'll see if I can have a look.
I put up my example in this gist here: https://gist.github.com/bkw/3dd96f05656a7e102e74
Thanks for considering this.
No problem I'll have a look in a little bit here!
In your through2
block there can you console.log
the file.base
and file.path
properties? I expect file.base
to be /path/to/views
and file.path
to be /path/to/views/index.jade
so that
file.path.substr(file.base.length + 1)
should produce index.jade
. Clearly this is not happening.
file.base: /path/to/views/
file.path: /path/to/views/index.html
it's index.html and not .jade because of the gulp.rename earlier.
seems we should trim slashes :-)
Yes! I will get to this soon :smile:
For some definition of "soon". Pretty big refactor which I think both addresses this issue (now using file.relative
) and makes the library easier to use. See updated README on homepage for new examples!
in my tests the first character of the destination file is dropped. I think filepath.substr in https://github.com/izaakschroeder/vinyl-s3/blob/master/lib/write-stream.js#L36 should not add +1 to the file.base.length.