From 6dee76240f8f08cedb3561c2ad76cb135141cb84 Mon Sep 17 00:00:00 2001
From: Peter Hedenskog <phedenskog@wikimedia.org>
Date: Wed, 19 Jun 2024 13:45:02 +0200
Subject: [PATCH] fix

---
 server/src/middleware/validateurl.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/server/src/middleware/validateurl.js b/server/src/middleware/validateurl.js
index 1bf7d54..0a103d1 100644
--- a/server/src/middleware/validateurl.js
+++ b/server/src/middleware/validateurl.js
@@ -13,7 +13,7 @@ export const validateURL = (request, response, next) => {
   const testDomain = nconf.get('validTestDomains');
 
   // If its an API call using script, do not validate the URL
-  if (request.body.api.scripting) {
+  if (request.body.api && request.body.api.scripting) {
     return next();
   }