Skip to content

Commit

Permalink
Merge pull request #15 from cmbuckley/master
Browse files Browse the repository at this point in the history
[Fixes #14] hash content for filename
  • Loading branch information
tomnomnom authored Jan 1, 2018
2 parents 5619370 + 41ca1a2 commit c3c5df3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions response.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ func (r response) String() string {

func (r response) save(pathPrefix string) (string, error) {

checksum := sha1.Sum([]byte(r.request.url.String()))
content := []byte(r.String())
checksum := sha1.Sum(content)
parts := []string{pathPrefix}

parts = append(parts, r.request.url.Hostname())
Expand All @@ -60,7 +61,7 @@ func (r response) save(pathPrefix string) (string, error) {
}
}

err := ioutil.WriteFile(p, []byte(r.String()), 0640)
err := ioutil.WriteFile(p, content, 0640)
if err != nil {
return p, err
}
Expand Down

0 comments on commit c3c5df3

Please sign in to comment.