Skip to content

Commit 447b091

Browse files
committed
encode img before uploading to ipfs
1 parent 8d36ca6 commit 447b091

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

kvasir/execute.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -250,14 +250,6 @@ func uploadToIPFS(c *Context, l *Logger, file []byte, report ReportMsgWithKey) (
250250
os.Remove(string(file))
251251
}()
252252

253-
// Connect to local IPFS node
254-
sh := shell.NewShell(c.ipfs)
255-
// Upload the image to IPFS
256-
pngCID, err := sh.Add(pngFile, shell.Pin(true))
257-
if err != nil {
258-
return "", err
259-
}
260-
261253
img, err := png.Decode(pngFile)
262254
if err != nil {
263255
return "", err
@@ -283,6 +275,14 @@ func uploadToIPFS(c *Context, l *Logger, file []byte, report ReportMsgWithKey) (
283275
return "", err
284276
}
285277

278+
// Connect to local IPFS node
279+
sh := shell.NewShell(c.ipfs)
280+
// Upload the image to IPFS
281+
pngCID, err := sh.Add(pngFile, shell.Pin(true))
282+
if err != nil {
283+
return "", err
284+
}
285+
286286
jpgCID, err := sh.Add(jpgFile, shell.Pin(true))
287287
if err != nil {
288288
return "", err

0 commit comments

Comments
 (0)