From 5ff9ed909ea75e1cd7b4c9547ebbaaf68c35048d Mon Sep 17 00:00:00 2001 From: Curry Yang <163384738+CurryYangxx@users.noreply.github.com> Date: Tue, 26 Mar 2024 07:54:33 +0800 Subject: [PATCH] fix: startsWith not a function error (#7201) --- packages/insomnia/src/ui/routes/project.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/insomnia/src/ui/routes/project.tsx b/packages/insomnia/src/ui/routes/project.tsx index b22b38d731c..d731388e9e4 100644 --- a/packages/insomnia/src/ui/routes/project.tsx +++ b/packages/insomnia/src/ui/routes/project.tsx @@ -373,6 +373,8 @@ async function getAllLocalFiles({ modifiedLocally > workspaceMeta?.cachedGitLastCommitTime ); + const specVersion = spec?.info?.version ? String(spec?.info?.version) : ''; + return { id: workspace._id, name: workspace.name, @@ -382,7 +384,7 @@ async function getAllLocalFiles({ lastModifiedTimestamp: (hasUnsavedChanges && modifiedLocally) || workspaceMeta?.cachedGitLastCommitTime || lastModifiedTimestamp, branch: lastActiveBranch || '', lastCommit: hasUnsavedChanges && workspaceMeta?.cachedGitLastCommitTime && lastCommitAuthor ? `by ${lastCommitAuthor}` : '', - version: spec?.info?.version ? `${spec?.info?.version?.startsWith('v') ? '' : 'v'}${spec?.info?.version}` : '', + version: specVersion ? `${specVersion?.startsWith('v') ? '' : 'v'}${specVersion}` : '', oasFormat: specFormat ? `${specFormat === 'openapi' ? 'OpenAPI' : 'Swagger'} ${specFormatVersion || ''}` : '', mockServer, apiSpec,