extensions
extensions copied to clipboard
storage-resize-images: prevent double trigger by honoring resizedImage flag (string or boolean)
The storage-resize-images function could run twice for a single upload if the resized outputs re-triggered the function. This happens when resizedImage custom metadata is stored as a boolean true while the filter only checked for the string "true".
Changes
- filters: treat
metadata.resizedImage === trueor"true"as already-resized to short‑circuit early. - upload: set
resizedImagemetadata to string "true" for consistency with existing expectations. - tests: add coverage for the boolean variant in metadata checks.
Why
- Cloud Storage custom metadata can arrive as a boolean or a string; handling both ensures idempotence and prevents reprocessing outputs.
Fixes #932.
Hi, thanks for opening this issue! I'm not sure it will fix #932 though, as the function will still be invoked? The filtering happens after the invocation within the runtime of the function. Making this more robust is still worthwhile though, we'll review this and hopefully get it out ASAP