Skip to content

Commit

Permalink
Merge pull request #21 from rabadin/cleanup-tmp-dir
Browse files Browse the repository at this point in the history
Ensure no temporary directories are left behind
  • Loading branch information
rabadin authored Aug 29, 2024
2 parents 33271b9 + c3eeb21 commit b350ab9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ package internal
import (
"context"
"crypto/sha256"
b64 "encoding/base64"
"encoding/hex"
"fmt"
"net/url"
"os"
Expand Down Expand Up @@ -68,7 +68,7 @@ func GetUrlToDir(u string, targetDir string, ctx context.Context) (string, error
// create temporary name in the target directory.
h := sha256.New()
h.Write([]byte(u))
fileName := filepath.Join(targetDir, fmt.Sprintf(".%s", b64.StdEncoding.EncodeToString(h.Sum(nil))))
fileName := filepath.Join(targetDir, fmt.Sprintf(".%s", hex.EncodeToString(h.Sum(nil))))
return getUrl(u, fileName, ctx)
}

Expand Down

0 comments on commit b350ab9

Please sign in to comment.