aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/git-lfs-authenticate
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/git-lfs-authenticate')
-rw-r--r--cmd/git-lfs-authenticate/main.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/cmd/git-lfs-authenticate/main.go b/cmd/git-lfs-authenticate/main.go
index 7a8a778..fc98246 100644
--- a/cmd/git-lfs-authenticate/main.go
+++ b/cmd/git-lfs-authenticate/main.go
@@ -132,7 +132,7 @@ func main() {
132 die("expected 2 arguments (path, operation), got %d", len(os.Args)-1) 132 die("expected 2 arguments (path, operation), got %d", len(os.Args)-1)
133 } 133 }
134 134
135 repoPath := strings.TrimPrefix(strings.TrimSuffix(os.Args[1], ".git"), "/") 135 repo := strings.TrimPrefix(strings.TrimSuffix(os.Args[1], ".git"), "/")
136 operation := os.Args[2] 136 operation := os.Args[2]
137 if operation != "download" && operation != "upload" { 137 if operation != "download" && operation != "upload" {
138 die("expected operation to be upload or download, got %s", operation) 138 die("expected operation to be upload or download, got %s", operation)
@@ -179,10 +179,10 @@ func main() {
179 } 179 }
180 privateKey := ed25519.NewKeyFromSeed(seed) 180 privateKey := ed25519.NewKeyFromSeed(seed)
181 181
182 if !getGitoliteAccess(logger, reqID, repoPath, user, "R") { 182 if !getGitoliteAccess(logger, reqID, repo, user, "R") {
183 die("repository not found") 183 die("repository not found")
184 } 184 }
185 if operation == "upload" && !getGitoliteAccess(logger, reqID, repoPath, user, "W") { 185 if operation == "upload" && !getGitoliteAccess(logger, reqID, repo, user, "W") {
186 // User has read access but no write access 186 // User has read access but no write access
187 die("forbidden") 187 die("forbidden")
188 } 188 }
@@ -190,7 +190,7 @@ func main() {
190 expiresIn := time.Hour * 24 190 expiresIn := time.Hour * 24
191 claims := customClaims{ 191 claims := customClaims{
192 Gitolfs3: gitolfs3Claims{ 192 Gitolfs3: gitolfs3Claims{
193 Repository: repoPath, 193 Repository: repo,
194 Permission: operation, 194 Permission: operation,
195 }, 195 },
196 RegisteredClaims: &jwt.RegisteredClaims{ 196 RegisteredClaims: &jwt.RegisteredClaims{
@@ -215,7 +215,7 @@ func main() {
215 } 215 }
216 if repoHRefBase != nil { 216 if repoHRefBase != nil {
217 response.HRef = repoHRefBase.ResolveReference(&url.URL{ 217 response.HRef = repoHRefBase.ResolveReference(&url.URL{
218 Path: path.Join(repoPath, "/info/lfs"), 218 Path: path.Join(repo+".git", "/info/lfs"),
219 }).String() 219 }).String()
220 } 220 }
221 json.NewEncoder(os.Stdout).Encode(response) 221 json.NewEncoder(os.Stdout).Encode(response)