From 9d79586b2d87d8073dfb158d192d5ae14512d5f8 Mon Sep 17 00:00:00 2001 From: Sidharthan Chandrasekaran Kamaraj Date: Fri, 10 Jan 2025 22:50:11 +0100 Subject: [PATCH 1/3] fix --- backend/pkg/router/router.go | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/backend/pkg/router/router.go b/backend/pkg/router/router.go index ae269b1..829935a 100644 --- a/backend/pkg/router/router.go +++ b/backend/pkg/router/router.go @@ -42,13 +42,7 @@ func New(lc fx.Lifecycle, envCfg *config.Config, zapLog *zap.SugaredLogger) Rout engine.RedirectTrailingSlash = false // Configure CORS - engine.Use(cors.New(cors.Config{ - AllowOrigins: []string{"*"}, - AllowMethods: []string{"GET", "POST", "PUT", "DELETE", "OPTIONS"}, - AllowHeaders: []string{"Origin", "Content-Type", "Authorization"}, - ExposeHeaders: []string{"Content-Length"}, - AllowCredentials: true, - })) + engine.Use(cors.Default()) server := &http.Server{ ReadTimeout: 30 * time.Second, From b2d3c970c161a339c63c1037990ec0f0fabbb67e Mon Sep 17 00:00:00 2001 From: Sidharthan Chandrasekaran Kamaraj Date: Fri, 10 Jan 2025 22:57:27 +0100 Subject: [PATCH 2/3] fix index page --- frontend/pages/index.vue | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/frontend/pages/index.vue b/frontend/pages/index.vue index 0fe080b..e96ca7c 100644 --- a/frontend/pages/index.vue +++ b/frontend/pages/index.vue @@ -248,6 +248,10 @@ const formData = ref({ const config = useRuntimeConfig() const accessUrl = computed(() => { if (!result.value) return '' + // if result.value is not a valid uuid, return an empty string + if (!/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/.test(result.value)) { + return '' + } const baseUrl = window.location.origin return `${baseUrl}/access/${result.value}` }) From 1c1fe76f83d6203b3fa2642f443d7b76d8098b02 Mon Sep 17 00:00:00 2001 From: Sidharthan Chandrasekaran Kamaraj Date: Fri, 10 Jan 2025 22:58:08 +0100 Subject: [PATCH 3/3] fix access url --- frontend/pages/index.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/pages/index.vue b/frontend/pages/index.vue index e96ca7c..14187d3 100644 --- a/frontend/pages/index.vue +++ b/frontend/pages/index.vue @@ -250,7 +250,7 @@ const accessUrl = computed(() => { if (!result.value) return '' // if result.value is not a valid uuid, return an empty string if (!/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/.test(result.value)) { - return '' + return result.value } const baseUrl = window.location.origin return `${baseUrl}/access/${result.value}`