From 35a471f1208e54433a0c8967d99257e92bc32e5a Mon Sep 17 00:00:00 2001 From: Claudio Pennati Date: Fri, 7 Feb 2025 10:51:18 +0100 Subject: [PATCH] fix: import openapi file servers url detection (#4373) Co-authored-by: Claudio Pennati --- .../src/helpers/import-export/import/openapi.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/hoppscotch-common/src/helpers/import-export/import/openapi.ts b/packages/hoppscotch-common/src/helpers/import-export/import/openapi.ts index 1ea2a758..c2db7c2b 100644 --- a/packages/hoppscotch-common/src/helpers/import-export/import/openapi.ts +++ b/packages/hoppscotch-common/src/helpers/import-export/import/openapi.ts @@ -735,7 +735,7 @@ const parseOpenAPIUrl = ( * Relevant v3 reference: https://swagger.io/specification/#server-object **/ if (objectHasProperty(doc, "servers")) { - return doc.servers?.[0].url ?? "<>" + return doc.servers?.[0]?.url ?? "<>" } // If the document is neither v2 nor v3 then return a env variable as placeholder