You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`Keys can only contain letters, numbers, percentage signs (%), exclamation marks (!), dots (.), asterisks (*), single quotes ('), parentheses (()), dashes (-) and underscores (_) up to a maximum of 800 characters. Keys can also contain forward slashes (/), but must not start with one.`,
`Keys can only contain letters, numbers, percentage signs (%), exclamation marks (!), dots (.), asterisks (*), single quotes ('), parentheses (()), dashes (-) and underscores (_) up to a maximum of 800 characters. Keys can also contain forward slashes (/), but must not start with one.`,
`Keys can only contain letters, numbers, percentage signs (%), exclamation marks (!), dots (.), asterisks (*), single quotes ('), parentheses (()), dashes (-) and underscores (_) up to a maximum of 800 characters. Keys can also contain forward slashes (/), but must not start with one.`,
test('Throws when the name of the store starts with the `deploy:` prefix',async()=>{
1224
+
test('Throws when the name of the store fails validation',async()=>{
1180
1225
const{ fetch }=newMockFetch()
1181
1226
1182
1227
globalThis.fetch=fetch
1183
1228
1229
+
expect(()=>
1230
+
getStore({
1231
+
name: 'some/store',
1232
+
token: apiToken,
1233
+
siteID,
1234
+
}),
1235
+
).toThrowError(
1236
+
`Store name can only contain letters, numbers, percentage signs (%), exclamation marks (!), dots (.), asterisks (*), single quotes ('), parentheses (()), dashes (-) and underscores (_) up to a maximum of 64 characters.`,
1237
+
)
1238
+
1239
+
expect(()=>
1240
+
getStore({
1241
+
name: 'a'.repeat(70),
1242
+
token: apiToken,
1243
+
siteID,
1244
+
}),
1245
+
).toThrowError(
1246
+
`Store name can only contain letters, numbers, percentage signs (%), exclamation marks (!), dots (.), asterisks (*), single quotes ('), parentheses (()), dashes (-) and underscores (_) up to a maximum of 64 characters.`,
1247
+
)
1248
+
1184
1249
expect(()=>
1185
1250
getStore({
1186
1251
name: 'deploy:foo',
1187
1252
token: apiToken,
1188
1253
siteID,
1189
1254
}),
1190
-
).toThrowError('Store name cannot start with the string `deploy:`, which is a reserved namespace')
1255
+
).toThrowError('Store name cannot start with the string `deploy:`, which is a reserved namespace.')
'Netlify Blobs could not find a `fetch` client in the global scope. You can either update your runtime to a version that includes `fetch` (like Node.js 18.0.0 or above), or you can supply your own implementation using the `fetch` property.',
"Keys can only contain letters, numbers, percentage signs (%), exclamation marks (!), dots (.), asterisks (*), single quotes ('), parentheses (()), dashes (-) and underscores (_) up to a maximum of 800 characters. Keys can also contain forward slashes (/), but must not start with one.",
231
+
)
232
+
}
233
+
}
234
+
235
+
staticvalidateDeployID(deployID: string){
236
+
// We could be stricter here and require a length of 24 characters, but the
237
+
// CLI currently uses a deploy of `0` when running Netlify Dev, since there
238
+
// is no actual deploy at that point. Let's go with a more loose validation
239
+
// logic here until we update the CLI.
240
+
if(!/^\w{1,24}$/.test(deployID)){
241
+
thrownewError(`'${deployID}' is not a valid Netlify deploy ID.`)
242
+
}
243
+
}
244
+
245
+
staticvalidateStoreName(name: string){
246
+
if(name.startsWith('deploy:')){
247
+
thrownewError('Store name cannot start with the string `deploy:`, which is a reserved namespace.')
248
+
}
249
+
250
+
if(!/^[\w%!.*'()-]{1,64}$/.test(name)){
251
+
thrownewError(
252
+
"Store name can only contain letters, numbers, percentage signs (%), exclamation marks (!), dots (.), asterisks (*), single quotes ('), parentheses (()), dashes (-) and underscores (_) up to a maximum of 64 characters.",
0 commit comments