From 0354d5b8c42f4a3aaca02a973361a8266f7ff8bb Mon Sep 17 00:00:00 2001 From: Seongmin Lee Date: Mon, 27 Jul 2026 05:26:01 +0900 Subject: [PATCH] knotmirror/xrpc: skip blob size check on submodules Signed-off-by: Seongmin Lee --- knotmirror/xrpc/git_get_entry.go | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/knotmirror/xrpc/git_get_entry.go b/knotmirror/xrpc/git_get_entry.go index 361b301a..e8fbdf14 100644 --- a/knotmirror/xrpc/git_get_entry.go +++ b/knotmirror/xrpc/git_get_entry.go @@ -56,11 +56,17 @@ func (x *Xrpc) GetEntry(w http.ResponseWriter, r *http.Request) { writeJson(w, http.StatusNotFound, atclient.ErrorBody{Name: "EntryNotFound", Message: fmt.Sprintf("entry %q not found", path)}) return } - size, err := gitea.GetBlobSize(ctx, repoPath, entry.Hash) - if err != nil { - l.Error("failed to read blob size", "err", err) - writeJson(w, http.StatusInternalServerError, atclient.ErrorBody{Name: "InternalServerError", Message: "failed to read blob size"}) - return + var size int64 + switch entry.Mode { + case filemode.Empty, filemode.Dir, filemode.Submodule: + // no-op + default: + size, err = gitea.GetBlobSize(ctx, repoPath, entry.Hash) + if err != nil { + l.Error("failed to read blob size", "err", err) + writeJson(w, http.StatusInternalServerError, atclient.ErrorBody{Name: "InternalServerError", Message: "failed to read blob size"}) + return + } } var outLastCommit *tangled.GitTempDefs_Commit -- 2.51.2