From 704bb4164c84e23cb6fd32b4c1a14899df74bc0c Mon Sep 17 00:00:00 2001 From: Lucas Date: Thu, 18 Sep 2025 06:35:31 +0200 Subject: [PATCH] feat(gist): retrieve full content for truncated gist files * Added logic to fetch the full content of a gist file if it is marked as truncated. * Utilizes the `GetRawGistFile` function to obtain the complete content from the provided `RawURL`. --- pkg/cmd/gist/view/view.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pkg/cmd/gist/view/view.go b/pkg/cmd/gist/view/view.go index f789c5b04..9eb906cde 100644 --- a/pkg/cmd/gist/view/view.go +++ b/pkg/cmd/gist/view/view.go @@ -136,6 +136,16 @@ func viewRun(opts *ViewOptions) error { defer opts.IO.StopPager() render := func(gf *shared.GistFile) error { + if gf.Truncated { + fullContent, err := shared.GetRawGistFile(client, gf.RawURL) + + if err != nil { + return err + } + + gf.Content = fullContent + } + if shared.IsBinaryContents([]byte(gf.Content)) { if len(gist.Files) == 1 || opts.Filename != "" { return fmt.Errorf("error: file is binary")