1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-01 08:02:49 -05:00

[EC-584] Add TryParse to ClientVersion due to QA builds having an appended git hash

This commit is contained in:
Rui Tome
2022-11-08 11:15:07 +00:00
parent 3e092be55c
commit 8d381dc524
2 changed files with 3 additions and 3 deletions

View File

@ -42,7 +42,7 @@ public class OrganizationExportController : Controller
(IEnumerable<CipherOrganizationDetails> orgCiphers, Dictionary<Guid, IGrouping<Guid, CollectionCipher>> collectionCiphersGroupDict) = await _cipherService.GetOrganizationCiphers(userId, organizationId);
// Backward compatibility with versions before 2022.11.0 that use ListResponseModel
if (_currentContext.ClientVersion < new Version("2022.11.0"))
if (_currentContext.ClientVersion != null && _currentContext.ClientVersion < new Version("2022.11.0"))
{
var organizationExportListResponseModel = new OrganizationExportListResponseModel
{

View File

@ -82,9 +82,9 @@ public class CurrentContext : ICurrentContext
MaybeBot = httpContext.Request.Headers["X-Cf-Maybe-Bot"] == "1";
}
if (httpContext.Request.Headers.ContainsKey("Bitwarden-Client-Version"))
if (httpContext.Request.Headers.ContainsKey("Bitwarden-Client-Version") && Version.TryParse(httpContext.Request.Headers["Bitwarden-Client-Version"], out var cVersion))
{
ClientVersion = new Version(httpContext.Request.Headers["Bitwarden-Client-Version"]);
ClientVersion = cVersion;
}
}