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`.
This commit is contained in:
Lucas 2025-09-18 06:35:31 +02:00
parent 62ea060590
commit 704bb4164c
No known key found for this signature in database

View file

@ -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")