use switch case in controller
MODIFY
WalletWasabi.Backend/Controllers/WasabiController.cs
WalletWasabi.Backend/Controllers/WasabiController.cs
@@ -23,22 +23,19 @@ public class WasabiController : ControllerBase
{
string filePath;
- // If the document id is null, then the request comes from WW1.0 client.
- if (id is null)
- {
- filePath = LegalDocuments.EmbeddedFilePathForWw1;
- }
- else
- {
- if (Version.TryParse(id, out var requestedVersion) && requestedVersion == Constants.Ww2LegalDocumentsVersion)
+ switch (id)
{
+ case "ww2":
filePath = LegalDocuments.EmbeddedFilePathForWw2;
- }
- else
- {
+ break;
+
+ case null:
+ filePath = LegalDocuments.EmbeddedFilePathForWw1; // If the document id is null, then the request comes from WW 1.0 client.
+ break;
+
+ default:
return NotFound();
}
- }
var content = await System.IO.File.ReadAllBytesAsync(filePath);
return File(content, "text/plain");

MODIFY
WalletWasabi/WebClients/Wasabi/WasabiClient.cs
WalletWasabi/WebClients/Wasabi/WasabiClient.cs
@@ -262,7 +262,7 @@ public class WasabiClient
{
using HttpResponseMessage response = await HttpClient.SendAsync(
HttpMethod.Get,
- $"/api/v{ApiVersion}/wasabi/legaldocuments?id={Helpers.Constants.Ww2LegalDocumentsVersion}",
+ $"/api/v{ApiVersion}/wasabi/legaldocuments?id=ww2",
cancel: cancel).ConfigureAwait(false);
if (response.StatusCode != HttpStatusCode.OK)

use switch case in controller