Skip to content
This repository has been archived by the owner on Aug 22, 2022. It is now read-only.

Commit

Permalink
Merge pull request #101 from requaos/requaos/gzip
Browse files Browse the repository at this point in the history
Apply hepa filters before gzip'ing content
  • Loading branch information
markbates authored Jun 3, 2020
2 parents d97c60c + fdcec3a commit d84a13e
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions pkging/embed/embed.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,15 @@ func Decode(src []byte) ([]byte, error) {
}

func Encode(b []byte) ([]byte, error) {
hep := hepa.New()
hep = hepa.With(hep, filters.Home())
hep = hepa.With(hep, filters.Golang())

b, err := hep.Filter(b)
if err != nil {
return nil, err
}

bb := &bytes.Buffer{}
gz := gzip.NewWriter(bb)

Expand All @@ -46,16 +55,7 @@ func Encode(b []byte) ([]byte, error) {
return nil, err
}

hep := hepa.New()
hep = hepa.With(hep, filters.Home())
hep = hepa.With(hep, filters.Golang())

b, err := hep.Filter(bb.Bytes())
if err != nil {
return nil, err
}

s := hex.EncodeToString(b)
s := hex.EncodeToString(bb.Bytes())
return []byte(s), nil
}

Expand Down

0 comments on commit d84a13e

Please sign in to comment.