From f21f229473cc6b51910c8c0a66eef0fb62bb10f9 Mon Sep 17 00:00:00 2001 From: Darshan Date: Sat, 22 Feb 2025 14:05:27 +0530 Subject: [PATCH 1/2] update: validate cron before updating. --- .../function-[function]/settings/updateSchedule.svelte | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/routes/(console)/project-[project]/functions/function-[function]/settings/updateSchedule.svelte b/src/routes/(console)/project-[project]/functions/function-[function]/settings/updateSchedule.svelte index d59ccecf8..a0fb10996 100644 --- a/src/routes/(console)/project-[project]/functions/function-[function]/settings/updateSchedule.svelte +++ b/src/routes/(console)/project-[project]/functions/function-[function]/settings/updateSchedule.svelte @@ -11,6 +11,7 @@ import { func } from '../store'; import { isValueOfStringEnum } from '$lib/helpers/types'; import { Runtime } from '@appwrite.io/console'; + import { parseExpression } from 'cron-parser'; const functionId = $page.params.function; let functionSchedule: string = null; @@ -24,6 +25,10 @@ if (!isValueOfStringEnum(Runtime, $func.runtime)) { throw new Error(`Invalid runtime: ${$func.runtime}`); } + + // an error is shown if invalid. + parseExpression(functionSchedule); + await sdk.forProject.functions.update( functionId, $func.name, From 9d9665a0802f4f5568e319ddf92ccdb9c1316a65 Mon Sep 17 00:00:00 2001 From: Darshan Date: Sat, 22 Feb 2025 17:36:44 +0530 Subject: [PATCH 2/2] ci: empty commit