serverless-image-handler icon indicating copy to clipboard operation
serverless-image-handler copied to clipboard

Fix TypeError when processing SVG images with undefined edits

Open chojs23 opened this issue 4 months ago • 0 comments

Issue #, if available:

#604

Description of changes:

When processing SVG images where imageRequestInfo.edits is undefined, the code was attempting to access edits.toFormat directly, causing a TypeError that crashed the lambda.

  • Fix TypeError when processing SVG images with undefined edits
  • Add optional chaining (?.) to safely access edits.toFormat property
  • Prevents "Cannot read properties of undefined (reading 'toFormat')" errors

Checklist

  • [x] :wave: I have added unit tests for all code changes.
  • [x] :wave: I have run the unit tests, and all unit tests have passed.
  • [ ] :warning: This pull request might incur a breaking change.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

chojs23 avatar Aug 20 '25 02:08 chojs23