diff --git a/app/soapbox/utils/__tests__/features.test.ts b/app/soapbox/utils/__tests__/features.test.ts index 3ba9c90ba..f214393d0 100644 --- a/app/soapbox/utils/__tests__/features.test.ts +++ b/app/soapbox/utils/__tests__/features.test.ts @@ -40,6 +40,7 @@ describe('parseVersion', () => { software: 'TruthSocial', version: '1.0.0', compatVersion: '3.4.1', + build: 'nightly-20230627', }); }); @@ -62,6 +63,15 @@ describe('parseVersion', () => { build: 'cofe', }); }); + + it('with Mastodon nightly build', () => { + const version = '4.1.2+nightly-20230627'; + expect(parseVersion(version)).toEqual({ + software: 'Mastodon', + version: '4.1.2', + compatVersion: '4.1.2', + }); + }); }); describe('getFeatures', () => { diff --git a/app/soapbox/utils/features.ts b/app/soapbox/utils/features.ts index 77ba331cb..126248e5d 100644 --- a/app/soapbox/utils/features.ts +++ b/app/soapbox/utils/features.ts @@ -992,7 +992,7 @@ interface Backend { /** Get information about the software from its version string */ export const parseVersion = (version: string): Backend => { - const regex = /^([\w+.]*)(?: \(compatible; ([\w]*) (.*)\))?$/; + const regex = /^([\w+.-]*)(?: \(compatible; ([\w]*) (.*)\))?$/; const match = regex.exec(version); const semverString = match && (match[3] || match[1]);