Skip to content

Commit

Permalink
fix tests from PR #403
Browse files Browse the repository at this point in the history
  • Loading branch information
TheCactusBlue committed Feb 11, 2025
1 parent 064b522 commit 9a25336
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 31 deletions.
45 changes: 15 additions & 30 deletions apps/e2e/tests/backend/endpoints/api/v1/projects.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -337,39 +337,24 @@ it("should not allow protocols other than http(s) in trusted domains", async ({
});
expect(response).toMatchInlineSnapshot(`
NiceResponse {
"status": 200,
"status": 400,
"body": {
"config": {
"allow_localhost": true,
"client_team_creation_enabled": false,
"client_user_deletion_enabled": false,
"create_team_on_sign_up": false,
"credential_enabled": true,
"domains": [
{
"domain": "whatever://disallowed-domain.stack-test.example.com",
"handler_path": "/handler",
},
],
"email_config": { "type": "shared" },
"enabled_oauth_providers": [],
"id": "<stripped UUID>",
"legacy_global_jwt_signing": false,
"magic_link_enabled": false,
"oauth_providers": [],
"passkey_enabled": false,
"sign_up_enabled": true,
"team_creator_default_permissions": [{ "id": "admin" }],
"team_member_default_permissions": [{ "id": "member" }],
"code": "SCHEMA_ERROR",
"details": {
"message": deindent\`
Request validation failed on PATCH /api/v1/projects/current:
- URL must start with http:// or https://
\`,
},
"created_at_millis": <stripped field 'created_at_millis'>,
"description": "",
"display_name": "New Project",
"id": "<stripped UUID>",
"is_production_mode": false,
"user_count": 0,
"error": deindent\`
Request validation failed on PATCH /api/v1/projects/current:
- URL must start with http:// or https://
\`,
},
"headers": Headers {
"x-stack-known-error": "SCHEMA_ERROR",
<some fields may have been hidden>,
},
"headers": Headers { <some fields may have been hidden> },
}
`);
});
Expand Down
3 changes: 2 additions & 1 deletion packages/stack-shared/src/interface/crud/projects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ export const emailConfigSchema = yupObject({

const domainSchema = yupObject({
domain: schemaFields.urlSchema.defined()
.meta({ openapiField: { description: 'URL. Must either start with https:// or', exampleValue: 'https://example.com' } }),
.matches(/^https?:\/\//, 'URL must start with http:// or https://')
.meta({ openapiField: { description: 'URL. Must start with http:// or https://', exampleValue: 'https://example.com' } }),
handler_path: schemaFields.handlerPathSchema.defined(),
});

Expand Down

0 comments on commit 9a25336

Please sign in to comment.