···
repo := fmt.Sprintf("%s/%s", f.OwnerDid(), f.Name)
113
-
archiveBytes, err := tangled.RepoArchive(r.Context(), xrpcc, "tar.gz", "", ref, repo)
113
+
// TODO: we are requesting the knot twice here to get permanent commit-hash.
114
+
// This should purely handled from knot instead.
115
+
rawHash, err := tangled.RepoResolveRef(r.Context(), xrpcc, ref, repo)
116
+
if xrpcerr := xrpcclient.HandleXrpcErr(err); xrpcerr != nil {
117
+
l.Error("failed to call XRPC repo.archive", "err", xrpcerr)
118
+
rp.pages.Error503(w)
121
+
hash := string(rawHash)
122
+
immutableLink := fmt.Sprintf(
123
+
"%s/%s/archive/%s",
124
+
rp.config.Core.AppviewHost,
129
+
archiveBytes, err := tangled.RepoArchive(r.Context(), xrpcc, "tar.gz", "", hash, repo)
if xrpcerr := xrpcclient.HandleXrpcErr(err); xrpcerr != nil {
l.Error("failed to call XRPC repo.archive", "err", xrpcerr)
···
w.Header().Set("Content-Disposition", fmt.Sprintf("attachment; filename=\"%s\"", filename))
w.Header().Set("Content-Type", "application/gzip")
w.Header().Set("Content-Length", fmt.Sprintf("%d", len(archiveBytes)))
142
+
w.Header().Set("Link", fmt.Sprintf("<%s>; rel=\"immutable\"", immutableLink))
// Write the archive data directly