Browse Source

fix: project title already in use disable self-match

Signed-off-by: mertmit <mertmit99@gmail.com>
pull/3368/head
mertmit 2 years ago
parent
commit
dabec18a07
  1. 4
      packages/nocodb/src/lib/meta/api/projectApis.ts

4
packages/nocodb/src/lib/meta/api/projectApis.ts

@ -46,12 +46,14 @@ export async function projectUpdate(
req: Request<any, any, any>, req: Request<any, any, any>,
res: Response<ProjectListType> res: Response<ProjectListType>
) { ) {
const project = await Project.getWithInfo(req.params.projectId);
// only support updating title at this moment // only support updating title at this moment
const data: any = { const data: any = {
title: DOMPurify.sanitize(req?.body?.title), title: DOMPurify.sanitize(req?.body?.title),
}; };
if (await Project.getByTitle(data.title)) { if (await Project.getByTitle(data.title) && project.title !== data.title) {
NcError.badRequest('Project title already in use'); NcError.badRequest('Project title already in use');
} }

Loading…
Cancel
Save