mirror of
https://github.com/trufflesecurity/trufflehog.git
synced 2024-09-20 14:42:03 +00:00
[chore] - use hex encode vs base64 (#1256)
* use hex encode vs base64. * fix tests.
This commit is contained in:
parent
2fbf86a6ab
commit
461f1a631e
2 changed files with 18 additions and 18 deletions
|
@ -2,7 +2,7 @@ package gcs
|
|||
|
||||
import (
|
||||
aCtx "context"
|
||||
"encoding/base64"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
|
@ -650,7 +650,7 @@ func (g *gcsManager) constructObject(ctx context.Context, obj *storage.ObjectHan
|
|||
o.contentType = attrs.ContentType
|
||||
o.owner = attrs.Owner
|
||||
o.link = attrs.MediaLink
|
||||
o.md5 = base64.StdEncoding.EncodeToString(attrs.MD5)
|
||||
o.md5 = hex.EncodeToString(attrs.MD5)
|
||||
o.createdAt = attrs.Created
|
||||
o.updatedAt = attrs.Updated
|
||||
o.acl = objectACLs(attrs.ACL)
|
||||
|
|
|
@ -480,7 +480,7 @@ func TestGCSManagerListObjects(t *testing.T) {
|
|||
size: 150,
|
||||
link: "https://storage.googleapis.com/download/storage/v1/b/test-bkt-th/o/aws1.txt?generation=1677870994890594&alt=media",
|
||||
acl: []string{},
|
||||
md5: "ek30X4Oc1ZSsI2sZUkzskg==",
|
||||
md5: "7a4df45f839cd594ac236b19524cec92",
|
||||
},
|
||||
{
|
||||
name: "moar2.txt",
|
||||
|
@ -489,7 +489,7 @@ func TestGCSManagerListObjects(t *testing.T) {
|
|||
size: 12,
|
||||
link: "https://storage.googleapis.com/download/storage/v1/b/test-bkt-th/o/moar2.txt?generation=1677871000378542&alt=media",
|
||||
acl: []string{},
|
||||
md5: "5Z/5eUEET4XfUpfhwwLSYA==",
|
||||
md5: "e59ff97941044f85df5297e1c302d260",
|
||||
},
|
||||
{
|
||||
name: "aws3.txt",
|
||||
|
@ -498,7 +498,7 @@ func TestGCSManagerListObjects(t *testing.T) {
|
|||
size: 150,
|
||||
link: "https://storage.googleapis.com/download/storage/v1/b/test-bkt-th2/o/aws3.txt?generation=1677871022489611&alt=media",
|
||||
acl: []string{},
|
||||
md5: "JusDN4oMjpnuDOz5FVrOgQ==",
|
||||
md5: "26eb03378a0c8e99ee0cecf9155ace81",
|
||||
},
|
||||
{
|
||||
name: "moar.txt",
|
||||
|
@ -507,7 +507,7 @@ func TestGCSManagerListObjects(t *testing.T) {
|
|||
size: 6,
|
||||
link: "https://storage.googleapis.com/download/storage/v1/b/test-bkt-th3/o/moar.txt?generation=1677871042896804&alt=media",
|
||||
acl: []string{},
|
||||
md5: "CffgLxKQviEdpweiZvFTsw==",
|
||||
md5: "09f7e02f1290be211da707a266f153b3",
|
||||
},
|
||||
{
|
||||
name: "AMAZON_FASHION_5.json",
|
||||
|
@ -516,7 +516,7 @@ func TestGCSManagerListObjects(t *testing.T) {
|
|||
size: 1413469,
|
||||
link: "https://storage.googleapis.com/download/storage/v1/b/test-bkt-th4/o/AMAZON_FASHION_5.json?generation=1677871063457469&alt=media",
|
||||
acl: []string{},
|
||||
md5: "Wh2PSDqjRpUlY3kFDUKitw==",
|
||||
md5: "5a1d8f483aa34695256379050d42a2b7",
|
||||
},
|
||||
},
|
||||
wantNumBkt: 4,
|
||||
|
@ -534,7 +534,7 @@ func TestGCSManagerListObjects(t *testing.T) {
|
|||
size: 150,
|
||||
link: "https://storage.googleapis.com/download/storage/v1/b/test-bkt-th/o/aws1.txt?generation=1677870994890594&alt=media",
|
||||
acl: []string{},
|
||||
md5: "ek30X4Oc1ZSsI2sZUkzskg==",
|
||||
md5: "7a4df45f839cd594ac236b19524cec92",
|
||||
},
|
||||
{
|
||||
name: "moar2.txt",
|
||||
|
@ -543,7 +543,7 @@ func TestGCSManagerListObjects(t *testing.T) {
|
|||
size: 12,
|
||||
link: "https://storage.googleapis.com/download/storage/v1/b/test-bkt-th/o/moar2.txt?generation=1677871000378542&alt=media",
|
||||
acl: []string{},
|
||||
md5: "5Z/5eUEET4XfUpfhwwLSYA==",
|
||||
md5: "e59ff97941044f85df5297e1c302d260",
|
||||
},
|
||||
},
|
||||
wantNumBkt: 1,
|
||||
|
@ -561,7 +561,7 @@ func TestGCSManagerListObjects(t *testing.T) {
|
|||
size: 6,
|
||||
link: "https://storage.googleapis.com/download/storage/v1/b/test-bkt-th3/o/moar.txt?generation=1677871042896804&alt=media",
|
||||
acl: []string{},
|
||||
md5: "CffgLxKQviEdpweiZvFTsw==",
|
||||
md5: "09f7e02f1290be211da707a266f153b3",
|
||||
},
|
||||
{
|
||||
name: "AMAZON_FASHION_5.json",
|
||||
|
@ -570,7 +570,7 @@ func TestGCSManagerListObjects(t *testing.T) {
|
|||
size: 1413469,
|
||||
link: "https://storage.googleapis.com/download/storage/v1/b/test-bkt-th4/o/AMAZON_FASHION_5.json?generation=1677871063457469&alt=media",
|
||||
acl: []string{},
|
||||
md5: "Wh2PSDqjRpUlY3kFDUKitw==",
|
||||
md5: "5a1d8f483aa34695256379050d42a2b7",
|
||||
},
|
||||
},
|
||||
wantNumBkt: 2,
|
||||
|
@ -592,7 +592,7 @@ func TestGCSManagerListObjects(t *testing.T) {
|
|||
size: 150,
|
||||
link: "https://storage.googleapis.com/download/storage/v1/b/test-bkt-th2/o/aws3.txt?generation=1677871022489611&alt=media",
|
||||
acl: []string{},
|
||||
md5: "JusDN4oMjpnuDOz5FVrOgQ==",
|
||||
md5: "26eb03378a0c8e99ee0cecf9155ace81",
|
||||
},
|
||||
{
|
||||
name: "moar.txt",
|
||||
|
@ -601,7 +601,7 @@ func TestGCSManagerListObjects(t *testing.T) {
|
|||
size: 6,
|
||||
link: "https://storage.googleapis.com/download/storage/v1/b/test-bkt-th3/o/moar.txt?generation=1677871042896804&alt=media",
|
||||
acl: []string{},
|
||||
md5: "CffgLxKQviEdpweiZvFTsw==",
|
||||
md5: "09f7e02f1290be211da707a266f153b3",
|
||||
},
|
||||
{
|
||||
name: "AMAZON_FASHION_5.json",
|
||||
|
@ -610,7 +610,7 @@ func TestGCSManagerListObjects(t *testing.T) {
|
|||
size: 1413469,
|
||||
link: "https://storage.googleapis.com/download/storage/v1/b/test-bkt-th4/o/AMAZON_FASHION_5.json?generation=1677871063457469&alt=media",
|
||||
acl: []string{},
|
||||
md5: "Wh2PSDqjRpUlY3kFDUKitw==",
|
||||
md5: "5a1d8f483aa34695256379050d42a2b7",
|
||||
},
|
||||
},
|
||||
wantNumBkt: 4, // We still list objects in all buckets.
|
||||
|
@ -632,7 +632,7 @@ func TestGCSManagerListObjects(t *testing.T) {
|
|||
size: 150,
|
||||
link: "https://storage.googleapis.com/download/storage/v1/b/test-bkt-th/o/aws1.txt?generation=1677870994890594&alt=media",
|
||||
acl: []string{},
|
||||
md5: "ek30X4Oc1ZSsI2sZUkzskg==",
|
||||
md5: "7a4df45f839cd594ac236b19524cec92",
|
||||
},
|
||||
},
|
||||
wantNumBkt: 1,
|
||||
|
@ -654,7 +654,7 @@ func TestGCSManagerListObjects(t *testing.T) {
|
|||
size: 150,
|
||||
link: "https://storage.googleapis.com/download/storage/v1/b/test-bkt-th/o/aws1.txt?generation=1677870994890594&alt=media",
|
||||
acl: []string{},
|
||||
md5: "ek30X4Oc1ZSsI2sZUkzskg==",
|
||||
md5: "7a4df45f839cd594ac236b19524cec92",
|
||||
},
|
||||
},
|
||||
wantNumBkt: 4,
|
||||
|
@ -677,7 +677,7 @@ func TestGCSManagerListObjects(t *testing.T) {
|
|||
size: 12,
|
||||
link: "https://storage.googleapis.com/download/storage/v1/b/test-bkt-th/o/moar2.txt?generation=1677871000378542&alt=media",
|
||||
acl: []string{},
|
||||
md5: "5Z/5eUEET4XfUpfhwwLSYA==",
|
||||
md5: "e59ff97941044f85df5297e1c302d260",
|
||||
},
|
||||
},
|
||||
wantNumBkt: 1,
|
||||
|
@ -765,7 +765,7 @@ func TestGCSManagerListObjects_Resuming(t *testing.T) {
|
|||
size: 12,
|
||||
link: "https://storage.googleapis.com/download/storage/v1/b/test-bkt-th/o/moar2.txt?generation=1677871000378542&alt=media",
|
||||
acl: []string{},
|
||||
md5: "5Z/5eUEET4XfUpfhwwLSYA==",
|
||||
md5: "e59ff97941044f85df5297e1c302d260",
|
||||
},
|
||||
},
|
||||
wantNumBkt: 1,
|
||||
|
|
Loading…
Reference in a new issue