Skip to content

feat(storage-resize-images): reject unknown IMAGE_TYPE values at config resolve time #3124

Description

@cabljac

resolveResizeImagesConfig (kits/storage-resize-images/src/export-config.ts:186) does toArray(config.imageTypes) ?? [DEFAULT_IMAGE_TYPE] with no validation. A stale .env from before #3064 carries IMAGE_TYPE=["False"], and that value does not fail the resize: resize-image.ts:103 treats it as a format because "False" !== "false", SUPPORTED_IMAGE_CONTENT_TYPE_MAP["False"] is undefined, the output is written as <name>_<size>.False with contentType: undefined (served as application/octet-stream), and the run reports success. Reproduced against the kit's bucket stub.

The extension has the same gap (functions/src/config.ts:85) but its YAML never stored False, so this is stricter than parity, hence a follow-up rather than part of #3064.

Proposed fix: add validateImageTypes() beside validateAbsolutePathList in export-config.ts, accepting "false" plus every key of SUPPORTED_IMAGE_CONTENT_TYPE_MAP (src/global.ts:29-39, so jpg/tif/jfif stay legal for library consumers) and throwing Invalid image type: <value> otherwise. Do not throw in convertType: tests/convert-image.test.ts:91-101 pins pass-through for unsupported formats such as raw, matching the extension's util.ts:247. Tests: reject ["False"], accept every map key, and route the existing multiSelect audit in tests/config.test.ts through resolveResizeImagesConfig. README differences section should note the kit rejects unknown imageTypes values where the extension passed them through.

Raised in #3064 review by @IzaakGough.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions