fix(storage-resize-images): map the Off content-filter option to OFF - #3064
fix(storage-resize-images): map the Off content-filter option to OFF#3064cabljac wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the CONTENT_FILTER_LEVEL configuration in the image resizing kit, changing the 'Off' option value from 'False' to 'OFF' and removing the unused CONTENT_FILTER_OPTIONS constant. It also adds tests to verify that configuration options resolve correctly. The review feedback highlights a backward compatibility issue where existing deployments using the retired 'False' value would crash upon upgrade, and suggests gracefully mapping 'False' to null to disable filtering instead of throwing an error.
Test report — no problems foundUnit tests + typecheck — Regression-proved by reverting Parity is exact. The extension's - param: CONTENT_FILTER_LEVEL
options:
- label: Off (No filtering)
value: OFFSo the kit's Also worth saying: reading the declared param back out of Live deploy — repacked the kit into a local functions-kit project and deployed all three resize instances to a real project: This is a real exercise of the fixed path rather than a formality — the deployed instance configs are Not verified: no image uploaded to confirm filtering is actually disabled at runtime. Application Default Credentials on this machine need reauth ( No problems found. |
The select option "Off (No filtering)" stored "False", which convertHarmBlockThreshold rejects, so a deployment with filtering off threw "Invalid HarmBlockThreshold: False" on every event. Map the option to "OFF", which the resolver converts to a null threshold, and delete the unused CONTENT_FILTER_OPTIONS const that recorded the intended values. Fixes #3047
…age-type option The IMAGE_TYPE multiSelect stored "False" while every consumer compares "false", so picking original asked sharp for a format named False and failed every resize. Pins the multiSelect option list and that every conversion value maps to a supported output content type, removes the unreferenced IMAGE_TYPE_OPTIONS and MEMORY_OPTIONS consts for the same reason CONTENT_FILTER_OPTIONS went, and documents the stored-value upgrade caveat for CONTENT_FILTER_LEVEL and IMAGE_TYPE in the CHANGELOG.
da26ef4 to
6053281
Compare
Picking "Off (No filtering)" for the content filter breaks the kit completely: the select option stored "False", the deployed environment carried CONTENT_FILTER_LEVEL=False, and convertHarmBlockThreshold threw "Invalid HarmBlockThreshold: False" on every storage event. The fix maps the option to "OFF", which the resolver converts to a null threshold and content-filter.ts treats as filtering disabled. The dead CONTENT_FILTER_OPTIONS const, which recorded the intended values but was used nowhere, is deleted.
New tests in tests/config.test.ts read the CONTENT_FILTER_LEVEL param from declaredParams and pin the full option list, resolve every option through resolveResizeImagesConfig (OFF yields a null threshold), and pin that "False" is rejected. The option-list and resolve tests fail on the previous code. Full kit suite, tsc -b, and prettier are clean. Verified in unit tests only; no live deploy was run.
Fixes #3047