-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
improvementImprovement to an existing feature.Improvement to an existing feature.
Description
The current implementation of image.Decode() in the card command reads chunks from the network on demand as it parses the image format. This means a large image that downloads slowly could timeout during the decode phase, even though the connection was still alive and making progress.
Using io.ReadAll first to read all the data into memory allows image.Decode() to decode instantly without network delays.
limitedBody := io.LimitReader(resp.Body, 10*1024*1024)
bodyBytes, err := io.ReadAll(limitedBody)
if err != nil {
return "", fmt.Errorf("failed to read image data: %w", err)
}
img, _, err := image.Decode(bytes.NewReader(bodyBytes))Metadata
Metadata
Assignees
Labels
improvementImprovement to an existing feature.Improvement to an existing feature.
Projects
Status
Building