mirror of
https://github.com/stack-auth/stack.git
synced 2026-06-04 21:04:37 +08:00
Remove empty profile image strings from database
This commit is contained in:
parent
ef935e24d8
commit
415dc2df42
1
.vscode/settings.json
vendored
1
.vscode/settings.json
vendored
@ -7,6 +7,7 @@
|
||||
"typescript.tsdk": "node_modules/typescript/lib",
|
||||
"editor.tabSize": 2,
|
||||
"cSpell.words": [
|
||||
"backlinks",
|
||||
"Cdfc",
|
||||
"cjsx",
|
||||
"clsx",
|
||||
|
||||
@ -0,0 +1,4 @@
|
||||
-- Some older versions allowed the empty string as a profile image.
|
||||
-- We fix that.
|
||||
|
||||
UPDATE "ProjectUser" SET "profileImageUrl" = NULL WHERE "profileImageUrl" = '';
|
||||
@ -1,6 +1,3 @@
|
||||
// This is your Prisma schema file,
|
||||
// learn more about it in the docs: https://pris.ly/d/prisma-schema
|
||||
|
||||
generator client {
|
||||
provider = "prisma-client-js"
|
||||
previewFeatures = ["tracing", "relationJoins"]
|
||||
|
||||
@ -1666,4 +1666,29 @@ describe("with server access", () => {
|
||||
}
|
||||
`);
|
||||
});
|
||||
|
||||
it("should not be able to set profile image url to empty string", async ({ expect }) => {
|
||||
await Auth.Otp.signIn();
|
||||
const response = await niceBackendFetch("/api/v1/users/me", {
|
||||
accessType: "server",
|
||||
method: "PATCH",
|
||||
body: {
|
||||
profile_image_url: "",
|
||||
},
|
||||
});
|
||||
expect(response).toMatchInlineSnapshot(`
|
||||
NiceResponse {
|
||||
"status": 400,
|
||||
"body": {
|
||||
"code": "SCHEMA_ERROR",
|
||||
"details": { "message": "Request validation failed on PATCH /api/v1/users/me:\\n - body.profile_image_url is not a valid URL" },
|
||||
"error": "Request validation failed on PATCH /api/v1/users/me:\\n - body.profile_image_url is not a valid URL",
|
||||
},
|
||||
"headers": Headers {
|
||||
"x-stack-known-error": "SCHEMA_ERROR",
|
||||
<some fields may have been hidden>,
|
||||
},
|
||||
}
|
||||
`);
|
||||
});
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user