File tree Expand file tree Collapse file tree 3 files changed +9
-12
lines changed Expand file tree Collapse file tree 3 files changed +9
-12
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " wrangler " : patch
3+ ---
4+
5+ Relax R2 bucket validation for ` pages dev ` commands
Original file line number Diff line number Diff line change @@ -115,7 +115,7 @@ describe.sequential.each([{ cmd: "wrangler pages dev" }])(
115115 }` ,
116116 } ) ;
117117 const worker = helper . runLongLived (
118- `${ cmd } --inspector-port ${ inspectorPort } . --port ${ port } --service TEST_SERVICE=test-worker --kv TEST_KV --do TEST_DO=TestDurableObject@a --d1 TEST_D1 --r2 test-r2 `
118+ `${ cmd } --inspector-port ${ inspectorPort } . --port ${ port } --service TEST_SERVICE=test-worker --kv TEST_KV --do TEST_DO=TestDurableObject@a --d1 TEST_D1 --r2 TEST_R2 `
119119 ) ;
120120 await worker . waitForReady ( ) ;
121121 expect ( normalizeOutput ( worker . currentOutput ) ) . toContain (
@@ -127,7 +127,7 @@ describe.sequential.each([{ cmd: "wrangler pages dev" }])(
127127 - D1 Databases:
128128 - TEST_D1: local-TEST_D1 (TEST_D1) [simulated locally]
129129 - R2 Buckets:
130- - test-r2: test-r2 [simulated locally]
130+ - TEST_R2: TEST_R2 [simulated locally]
131131 - Services:
132132 - TEST_SERVICE: test-worker [not connected]
133133 `
Original file line number Diff line number Diff line change @@ -17,7 +17,6 @@ import { logger } from "../logger";
1717import * as metrics from "../metrics" ;
1818import { isNavigatorDefined } from "../navigator-user-agent" ;
1919import { getBasePath } from "../paths" ;
20- import { bucketFormatMessage , isValidR2BucketName } from "../r2/helpers" ;
2120import * as shellquote from "../utils/shell-quote" ;
2221import { buildFunctions } from "./buildFunctions" ;
2322import { ROUTES_SPEC_VERSION , SECONDS_TO_WAIT_FOR_PROXY } from "./constants" ;
@@ -1270,15 +1269,8 @@ function getBindingsFromArgs(args: typeof pagesDevCommand.args): Partial<
12701269 return ;
12711270 }
12721271
1273- const bucketName = ref || binding . toString ( ) ;
1274-
1275- if ( ! isValidR2BucketName ( bucketName ) ) {
1276- logger . error (
1277- `The bucket name "${ bucketName } " is invalid. ${ bucketFormatMessage } `
1278- ) ;
1279- return ;
1280- }
1281-
1272+ // The generated `bucket_name` might be invalid as per https://developers.cloudflare.com/r2/buckets/create-buckets/#bucket-level-operations
1273+ // However this name only applies to the dev environment and is not validated by miniflare.
12821274 return { binding, bucket_name : ref || binding . toString ( ) } ;
12831275 } )
12841276 . filter ( Boolean ) as EnvironmentNonInheritable [ "r2_buckets" ] ;
You can’t perform that action at this time.
0 commit comments