From 3f301b8c1fe823de707282367f170d0ba777fc1a Mon Sep 17 00:00:00 2001 From: Vrganj Date: Thu, 14 Jan 2021 21:21:10 +0100 Subject: [PATCH] Fix version regex --- api/src/index.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/api/src/index.js b/api/src/index.js index d510eb9..e22b8cb 100644 --- a/api/src/index.js +++ b/api/src/index.js @@ -30,7 +30,13 @@ const { spawn } = require('child_process'); if (section.length >= 2) { const language = section[0]; - versions[language] = /\d.\d.\d/.exec(section.slice(1).join('\n'))?.[0]; + if (language === 'java') { + versions[language] = /\d+/.exec(section[2]); + } else if (language === 'emacs') { + versions[language] = /\d+\.\d+/.exec(section[2]); + } else { + versions[language] = /\d\.\d\.\d/.exec(section.slice(1).join('\n'))?.[0]; + } } }