aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/git-lfs-authenticate/main.go
diff options
context:
space:
mode:
authorLibravatar Rutger Broekhoff2024-01-09 23:22:34 +0100
committerLibravatar Rutger Broekhoff2024-01-09 23:22:34 +0100
commitb07332d62c347326baade26e3a3c281b83172615 (patch)
tree0b7fc32b7ea54ff1d0a501258b4275b8af87886e /cmd/git-lfs-authenticate/main.go
parentbc465de960aa5d53b28d51bd6bbead28433f2010 (diff)
downloadgitolfs3-b07332d62c347326baade26e3a3c281b83172615.tar.gz
gitolfs3-b07332d62c347326baade26e3a3c281b83172615.zip
Fix makehextag in git-lfs-authenticate (C)
Diffstat (limited to 'cmd/git-lfs-authenticate/main.go')
-rw-r--r--cmd/git-lfs-authenticate/main.go11
1 files changed, 7 insertions, 4 deletions
diff --git a/cmd/git-lfs-authenticate/main.go b/cmd/git-lfs-authenticate/main.go
index 3db0efe..59ed978 100644
--- a/cmd/git-lfs-authenticate/main.go
+++ b/cmd/git-lfs-authenticate/main.go
@@ -59,7 +59,7 @@ func main() {
59 os.Exit(1) 59 os.Exit(1)
60 } 60 }
61 61
62 repo := strings.TrimPrefix(path.Clean(strings.TrimSuffix(os.Args[1], ".git")), "/") 62 repo := strings.TrimPrefix(path.Clean(os.Args[1]), "/")
63 operation := os.Args[2] 63 operation := os.Args[2]
64 if operation != "download" && operation != "upload" { 64 if operation != "download" && operation != "upload" {
65 fmt.Println(usage) 65 fmt.Println(usage)
@@ -68,8 +68,11 @@ func main() {
68 if repo == ".." || strings.HasPrefix(repo, "../") { 68 if repo == ".." || strings.HasPrefix(repo, "../") {
69 die("highly illegal repo name (Anzeige ist raus)") 69 die("highly illegal repo name (Anzeige ist raus)")
70 } 70 }
71 if !strings.HasSuffix(repo, ".git") {
72 die("expected repo name to have '.git' suffix")
73 }
71 74
72 repoDir := path.Join(repo + ".git") 75 repoDir := path.Join(repo)
73 finfo, err := os.Stat(repoDir) 76 finfo, err := os.Stat(repoDir)
74 if err != nil { 77 if err != nil {
75 if errors.Is(err, fs.ErrNotExist) { 78 if errors.Is(err, fs.ErrNotExist) {
@@ -125,12 +128,12 @@ func main() {
125 128
126 response := authenticateResponse{ 129 response := authenticateResponse{
127 Header: map[string]string{ 130 Header: map[string]string{
128 "Authorization": "Tag " + tagStr, 131 "Authorization": "Gitolfs3-Hmac-Sha256 " + tagStr,
129 }, 132 },
130 ExpiresIn: int64(expiresIn.Seconds()), 133 ExpiresIn: int64(expiresIn.Seconds()),
131 HRef: fmt.Sprintf("%s%s?p=1&te=%d", 134 HRef: fmt.Sprintf("%s%s?p=1&te=%d",
132 hrefBase, 135 hrefBase,
133 path.Join(repo+".git", "/info/lfs"), 136 path.Join(repo, "/info/lfs"),
134 expiresAtUnix, 137 expiresAtUnix,
135 ), 138 ),
136 } 139 }