File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -155,15 +155,6 @@ func editRun(opts *EditOptions) error {
155155 // Transform our gist into the schema that the update endpoint expects
156156 filesToupdate := make (map [string ]* gistFileToUpdate , len (gist .Files ))
157157 for filename , file := range gist .Files {
158- if file .Truncated {
159- fullContent , err := shared .GetRawGistFile (client , file .RawURL )
160- if err != nil {
161- return err
162- }
163-
164- file .Content = fullContent
165- }
166-
167158 filesToupdate [filename ] = & gistFileToUpdate {
168159 Content : file .Content ,
169160 NewFilename : file .Filename ,
@@ -267,6 +258,17 @@ func editRun(opts *EditOptions) error {
267258 return fmt .Errorf ("editing binary files not supported" )
268259 }
269260
261+ // If the file is truncated, fetch the full content
262+ file := gist .Files [filename ]
263+ if file .Truncated {
264+ fullContent , err := shared .GetRawGistFile (client , file .RawURL )
265+ if err != nil {
266+ return err
267+ }
268+
269+ gistFile .Content = fullContent
270+ }
271+
270272 var text string
271273 if src := opts .SourceFile ; src != "" {
272274 if src == "-" {
You can’t perform that action at this time.
0 commit comments