Describe the bug
When editing a large gist (secret, so can't share directly) containing a single .md file (~1.6 MB, ~38,072 lines, ~1.7M bytes), using gh gist edit does not load the entire file content. The file is truncated to about 900K bytes (17,000 lines), instead of loading the full content.
This presents a risk: If a user edits and saves, the truncated file will overwrite the gist, resulting in data loss.
Affected version
⇒ gh version
gh version 2.67.0 (2025-02-11)
https://github.com/cli/cli/releases/tag/v2.67.0
Steps to reproduce the behavior
- Have a gist with a large file (e.g., 1.6 MB
.md file, ~38,000 lines).
- Run
gh gist edit <gist-id> (with any editor).
- Observe that the file content is cut off (e.g., only 900K of 1.6M bytes loaded).
- (Optional) Save the file, which would (presumably) overwrite the gist with a truncated version.
Expected vs actual behavior
Expected:
gh gist edit should load and allow editing of the entire file, regardless of size, or should display a clear error message if the file is too large to edit safely.
Actual:
- The file is silently truncated. No warning or error is given. Risk of accidental data loss if saved (presumably).
Logs
⇒ gh gist clone <gist-id> && cd <gist-id>
⇒ du -sh foo.md
1.6M foo.md
⇒ cat foo.md | wc -l
38072
⇒ cat foo.md | wc -c
1685200
⇒ EDITOR=cat gh gist edit <gist-id> | wc -l
17000
⇒ EDITOR=cat gh gist edit <gist-id> | wc -c
921600
⇒ EDITOR=cat gh gist edit <gist-id> | wc -c | numfmt --to=iec
900K
Describe the bug
When editing a large gist (secret, so can't share directly) containing a single
.mdfile (~1.6 MB, ~38,072 lines, ~1.7M bytes), usinggh gist editdoes not load the entire file content. The file is truncated to about 900K bytes (17,000 lines), instead of loading the full content.This presents a risk: If a user edits and saves, the truncated file will overwrite the gist, resulting in data loss.
Affected version
Steps to reproduce the behavior
.mdfile, ~38,000 lines).gh gist edit <gist-id>(with any editor).Expected vs actual behavior
Expected:
gh gist editshould load and allow editing of the entire file, regardless of size, or should display a clear error message if the file is too large to edit safely.Actual:
Logs