mirror of
https://github.com/Luzifer/s3sync.git
synced 2024-12-20 19:41:15 +00:00
Fix: Allow sync of subpaths from S3
This commit is contained in:
parent
da3f1326d4
commit
37a3283e19
1 changed files with 4 additions and 2 deletions
4
s3.go
4
s3.go
|
@ -16,6 +16,7 @@ import (
|
||||||
|
|
||||||
type s3Provider struct {
|
type s3Provider struct {
|
||||||
conn *s3.S3
|
conn *s3.S3
|
||||||
|
requestedPrefix string
|
||||||
}
|
}
|
||||||
|
|
||||||
func newS3Provider() (*s3Provider, error) {
|
func newS3Provider() (*s3Provider, error) {
|
||||||
|
@ -34,6 +35,7 @@ func (s *s3Provider) getBucketPath(prefix string) (bucket string, path string, e
|
||||||
|
|
||||||
bucket = matches[1]
|
bucket = matches[1]
|
||||||
path = strings.Replace(matches[2], string(os.PathSeparator), "/", -1)
|
path = strings.Replace(matches[2], string(os.PathSeparator), "/", -1)
|
||||||
|
s.requestedPrefix = path
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -105,7 +107,7 @@ func (s *s3Provider) readS3FileList(bucket string, path *string, outputChan chan
|
||||||
|
|
||||||
for _, v := range o.Contents {
|
for _, v := range o.Contents {
|
||||||
outputChan <- file{
|
outputChan <- file{
|
||||||
Filename: *v.Key,
|
Filename: strings.Replace(*v.Key, s.requestedPrefix, "", 1),
|
||||||
Size: *v.Size,
|
Size: *v.Size,
|
||||||
MD5: strings.Trim(*v.ETag, "\""), // Wat?
|
MD5: strings.Trim(*v.ETag, "\""), // Wat?
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue