mirror of
https://github.com/umami-software/umami.git
synced 2026-02-09 07:07:17 +01:00
Add share_id validation.
This commit is contained in:
parent
050cd2f5d9
commit
06e6cbec9a
2 changed files with 7 additions and 0 deletions
|
|
@ -4,6 +4,7 @@ import { Website, NextApiRequestQueryBody } from 'lib/types';
|
|||
import { canViewWebsite, canUpdateWebsite, canDeleteWebsite } from 'lib/auth';
|
||||
import { useAuth, useCors } from 'lib/middleware';
|
||||
import { deleteWebsite, getWebsite, updateWebsite } from 'queries';
|
||||
import { SHARE_ID_REGEX } from 'lib/constants';
|
||||
|
||||
export interface WebsiteRequestQuery {
|
||||
id: string;
|
||||
|
|
@ -43,6 +44,10 @@ export default async (
|
|||
|
||||
let website;
|
||||
|
||||
if (shareId && !shareId.match(SHARE_ID_REGEX)) {
|
||||
return serverError(res, 'Invalid share ID.');
|
||||
}
|
||||
|
||||
try {
|
||||
website = await updateWebsite(websiteId, { name, domain, shareId });
|
||||
} catch (e: any) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue