Skip to content

Commit d0208fe

Browse files
devin-ai-integration[bot]penalosaemily-shen
authored
[wrangler] Fix --env and --expires flag conflict in r2 object put (#10959)
* fix: remove -e alias from --expires in r2 object put Removes the -e alias from the --expires flag in wrangler r2 object put to resolve conflict with the global --env flag which also uses -e. Fixes #10921 Co-Authored-By: smacleod@cloudflare.com <smacleod@cloudflare.com> * Update .changeset/little-readers-bake.md * chore: trigger CI re-run to verify unrelated test failures Co-Authored-By: smacleod@cloudflare.com <smacleod@cloudflare.com> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: smacleod@cloudflare.com <smacleod@cloudflare.com> Co-authored-by: emily-shen <69125074+emily-shen@users.noreply.github.com>
1 parent dbe51c1 commit d0208fe

File tree

3 files changed

+22
-2
lines changed

3 files changed

+22
-2
lines changed

.changeset/little-readers-bake.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"wrangler": patch
3+
---
4+
5+
Fixed conflict between `--env` and `--expires` flags in `wrangler r2 object put`.
6+
7+
`--e` now aliases `--env` only, and NOT `--expires`.

packages/wrangler/src/__tests__/r2.test.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3889,7 +3889,7 @@ describe("r2", () => {
38893889
);
38903890
fs.writeFileSync("wormhole-img.png", "passageway");
38913891
const flags =
3892-
"--ct content-type-mock --cd content-disposition-mock --ce content-encoding-mock --cl content-lang-mock --cc cache-control-mock --e expire-time-mock";
3892+
"--ct content-type-mock --cd content-disposition-mock --ce content-encoding-mock --cl content-lang-mock --cc cache-control-mock --expires expire-time-mock";
38933893

38943894
await runWrangler(
38953895
`r2 object put --remote bucket-object-test/wormhole-img.png ${flags} --file wormhole-img.png`
@@ -3936,6 +3936,20 @@ describe("r2", () => {
39363936
"
39373937
`);
39383938
});
3939+
3940+
it("should allow --env and --expires to be used together without conflict", async () => {
3941+
writeWranglerConfig({
3942+
env: {
3943+
production: {},
3944+
},
3945+
});
3946+
fs.writeFileSync("wormhole-img.png", "passageway");
3947+
await runWrangler(
3948+
`r2 object put --remote bucket-object-test/wormhole-img.png --file ./wormhole-img.png --env production --expires 2024-12-31`
3949+
);
3950+
3951+
expect(std.out).toContain("Upload complete");
3952+
});
39393953
});
39403954
});
39413955
});

packages/wrangler/src/r2/object.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,6 @@ export const r2ObjectPutCommand = createCommand({
201201
},
202202
expires: {
203203
describe: "The date and time at which the object is no longer cacheable",
204-
alias: "e",
205204
requiresArg: true,
206205
type: "string",
207206
},

0 commit comments

Comments
 (0)