Skip to content

Commit

Permalink
Merge pull request #2 from kayac/keep-original-name
Browse files Browse the repository at this point in the history
Don't add suffix .gz when already it was having.
  • Loading branch information
FUJIWARA Shunichiro authored Aug 24, 2020
2 parents 24446e6 + a9c53ff commit df8f6c4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions router.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ var MetaHeaderName = "x-amz-meta-route-original"

var gzipMagicBytes = []byte{0x1f, 0x8b}

var gzipSuffix = ".gz"

var (
initialBufSize = 64 * 1024
maxBufSize = initialBufSize * 10
Expand Down Expand Up @@ -220,8 +222,8 @@ func (r *Router) genDestination(rec record, name string) (destination, error) {
return destination{}, err
}
key := path.Join(prefix, name)
if r.option.Gzip {
key = key + ".gz"
if r.option.Gzip && !strings.HasSuffix(name, gzipSuffix) {
key = key + gzipSuffix
}
return destination{
Bucket: r.option.Bucket,
Expand Down

0 comments on commit df8f6c4

Please sign in to comment.