Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions kits/storage-resize-images/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
- fix: the `IS_ANIMATED` "Yes" option was labelled "True" in the deploy-time prompt. The stored values are unchanged (`true`/`false`), so this is a label-only fix and no `.env` written by an earlier deploy needs editing.
- fix: the "Off (No filtering)" content-filter option now stores `OFF` instead of `False`, which the resolver rejected, so every storage event threw `Invalid HarmBlockThreshold: False`. A `.env` written by an earlier deploy keeps the stored value on upgrade: if it carries `CONTENT_FILTER_LEVEL=False`, edit it to `OFF` (or re-select the option).
- fix: the "original" image-type option now stores `false` instead of `False`. The resize path treated `False` as a target format, so each resized file was uploaded as `<name>_<size>.False` with no content type and reported as a success. A stored `IMAGE_TYPE=["False"]` likewise needs editing to `["false"]`.
- fix: restore the `us-central1` content-filter fallback. `checkImageContent` threw `FUNCTION_REGION is required for Vertex AI filtering.` when no region was available; the extension fell back to `us-central1`. The Vertex AI call now uses the function's region when known and `us-central1` otherwise, matching the extension. Normal CLI deploys were unaffected (the Firebase CLI sets `FUNCTION_REGION` on deployed functions); the throw was reachable for library consumers, emulator runs, and hand-rolled environments.
Expand Down
2 changes: 1 addition & 1 deletion kits/storage-resize-images/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ const params = {
description: "Keep animation of GIF and WEBP formats.",

default: true,
input: select({ True: true, "No (1st frame only)": false }),
input: select({ Yes: true, "No (1st frame only)": false }),
}),
memory: defineInt("FUNCTION_MEMORY", {
label: "Cloud Function memory",
Expand Down
22 changes: 22 additions & 0 deletions kits/storage-resize-images/tests/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -377,3 +377,25 @@ describe("validatePathListsFromEnv", () => {
expect(() => validatePathListsFromEnv()).toThrow(/Invalid excludePathList/);
});
});

/**
* The kit builds its select options from a label-to-value map, so a label
* typo is invisible to the value-only assertions above and only shows up in
* the CLI's deploy-time prompt. This pins the labels against
* `extension.yaml`'s `IS_ANIMATED` options.
*/
describe("IS_ANIMATED select", () => {
test("declares the same option labels and values as the extension", async () => {
await import("../src/config");
const { declaredParams } = await import("firebase-functions/params");

const param = declaredParams.find((p) => p.name === "IS_ANIMATED") as
| { options: { input?: { select?: { options: unknown[] } } } }
| undefined;

expect(param?.options.input?.select?.options).toEqual([
{ label: "Yes", value: true },
{ label: "No (1st frame only)", value: false },
]);
});
});
Loading