1
0
Fork 0
mirror of https://github.com/Luzifer/s3sync.git synced 2024-12-20 11:31:17 +00:00

Fix: Allow sync of subpaths from S3

This commit is contained in:
Knut Ahlers 2016-03-23 16:40:11 +01:00
parent da3f1326d4
commit 37a3283e19

6
s3.go
View file

@ -15,7 +15,8 @@ import (
)
type s3Provider struct {
conn *s3.S3
conn *s3.S3
requestedPrefix string
}
func newS3Provider() (*s3Provider, error) {
@ -34,6 +35,7 @@ func (s *s3Provider) getBucketPath(prefix string) (bucket string, path string, e
bucket = matches[1]
path = strings.Replace(matches[2], string(os.PathSeparator), "/", -1)
s.requestedPrefix = path
return
}
@ -105,7 +107,7 @@ func (s *s3Provider) readS3FileList(bucket string, path *string, outputChan chan
for _, v := range o.Contents {
outputChan <- file{
Filename: *v.Key,
Filename: strings.Replace(*v.Key, s.requestedPrefix, "", 1),
Size: *v.Size,
MD5: strings.Trim(*v.ETag, "\""), // Wat?
}