summaryrefslogtreecommitdiff
path: root/main.go
diff options
from:
to:
context:
space:
mode:
authorGravatar SayaAndy <saya.andy@posteo.com> 2026-03-30 02:19:08 +0700
committerGravatar SayaAndy <saya.andy@posteo.com> 2026-03-30 02:19:08 +0700
commit9effc519349612582a14f0402564725678f51d7f (patch)
tree20e9f7435d2b27e377adb786147c74b75114e7ee /main.go
parentebfe3540c333ae7fa3effb410a20e5764627e307 (diff)
downloadthumbnail-generator-9effc519349612582a14f0402564725678f51d7f.tar.gz
thumbnail-generator-9effc519349612582a14f0402564725678f51d7f.zip
fix: read input with readall
feat: update dependencies and go to 1.26
Diffstat (limited to 'main.go')
-rw-r--r--main.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/main.go b/main.go
index 5735e19..ae8cb6e 100644
--- a/main.go
+++ b/main.go
@@ -239,10 +239,14 @@ func main() {
return
}
- fileContent := make([]byte, inputMetadata.Size)
- if _, err = reader.Read(fileContent); err != nil {
+ fileContent, err := io.ReadAll(reader)
+ if err != nil {
fileLogger.Warn("fail to read content of input file", slog.String("error", err.Error()))
return
+ } else if int64(len(fileContent)) != inputMetadata.Size {
+ fileLogger.Warn("the downloaded file seems to be missing some of its content",
+ slog.Int("actual_size_bytes", len(fileContent)),
+ slog.Int64("expected_size_bytes", inputMetadata.Size))
}
reader.Close()