serverless-image-handler
serverless-image-handler copied to clipboard
Fix TypeError when processing SVG images with undefined edits
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.