Commit 103750f1 authored by Jacob Vosmaer's avatar Jacob Vosmaer

Pass ArchivePrefix from authBackend

parent 4d645003
......@@ -36,6 +36,7 @@ type gitEnv struct {
GL_ID string
RepoPath string
ArchivePath string
ArchivePrefix string
CommitId string
}
......@@ -222,9 +223,8 @@ func handleGetArchive(env gitEnv, format string, repoPath string, w http.Respons
}
archiveFilename := path.Base(env.ArchivePath)
archivePrefix := strings.TrimSuffix(archiveFilename, "."+format) + "/"
archiveCmd := gitCommand(env, "git", "--git-dir="+repoPath, "archive", "--format="+archiveFormat, "--prefix="+archivePrefix, env.CommitId)
archiveCmd := gitCommand(env, "git", "--git-dir="+repoPath, "archive", "--format="+archiveFormat, "--prefix="+env.ArchivePrefix+"/", env.CommitId)
archiveStdout, err := archiveCmd.StdoutPipe()
if err != nil {
fail500(w, "handleGetArchive", err)
......
......@@ -260,7 +260,18 @@ func gitOkBody(t *testing.T) string {
}
func archiveOkBody(t *testing.T, archiveName string) string {
return fmt.Sprintf(`{"RepoPath":"%s","ArchivePath":"/tmp/%s","CommitId":"c7fbe50c7c7419d9701eebe64b1fdacc3df5b9dd"}`, repoPath(t), archiveName)
cwd, err := os.Getwd()
if err != nil {
t.Fatal(err)
}
archivePath := path.Join(cwd, scratchDir, "cache", archiveName)
jsonString := `{
"RepoPath":"%s",
"ArchivePath":"/tmp/%s",
"CommitId":"c7fbe50c7c7419d9701eebe64b1fdacc3df5b9dd",
"ArchivePrefix":"foobar123"
}`
return fmt.Sprintf(jsonString, repoPath(t), archivePath)
}
func repoPath(t *testing.T) string {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment