This commit is contained in:
@@ -45,7 +45,6 @@ func (s *Service) assembleImageList(ctx context.Context) error {
|
||||
if err != nil {
|
||||
return fmt.Errorf("could not read contents of %s: %w", s.cfg.Path, err)
|
||||
}
|
||||
slog.Debug("loaded files", "files", files)
|
||||
|
||||
savedHash, _ := s.cache.Do(ctx, s.cache.B().Get().Key(hashKey).Build()).AsBytes()
|
||||
|
||||
@@ -77,10 +76,19 @@ func (s *Service) assembleImageList(ctx context.Context) error {
|
||||
continue
|
||||
}
|
||||
|
||||
w := img.Bounds().Dx()
|
||||
h := img.Bounds().Dy()
|
||||
|
||||
// FIX 2: Defensive check to guard against unreadable/corrupted image boundaries
|
||||
if w <= 0 || h <= 0 {
|
||||
slog.Warn("skipping image with zero or negative dimensions", "path", imagePath, "w", w, "h", h)
|
||||
continue
|
||||
}
|
||||
|
||||
imgs = append(imgs, Image{
|
||||
UID: uid,
|
||||
Width: img.Bounds().Dx(),
|
||||
Height: img.Bounds().Dy(),
|
||||
Width: w,
|
||||
Height: h,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user