Clarify logical S3 usage vs physical disk free and harden null request handling

This commit is contained in:
OpenGenesis (MPL 2.0) committed 2026-11-16 17:41:44 +01:00
1 parent bb606f8a10
commit d0f3f13e5c
1 file changed
+4 -3
@@ -2,7 +2,6 @@
// Optional, fail-closed public Garage monitoring. No S3 credentials are used here.
using System;
using System.IO;
using System.Text;
using System.Text.Json;
using Nini.Config;
using OpenSim.Framework.Servers.HttpServer;
@@ -36,7 +35,7 @@ namespace NexVerse.Server.Api
response.ContentType = "application/json; charset=utf-8";
response.AddHeader("X-Content-Type-Options", "nosniff");
response.AddHeader("Cache-Control", "no-store");
if (!string.Equals(request.HttpMethod, "GET", StringComparison.OrdinalIgnoreCase))
if (request == null || !string.Equals(request.HttpMethod, "GET", StringComparison.OrdinalIgnoreCase))
{
response.StatusCode = 405;
response.AddHeader("Allow", "GET");
@@ -78,9 +77,11 @@ namespace NexVerse.Server.Api
storage = new {
capacity_bytes = capacity,
used_bytes = used,
free_bytes = capacity - used,
remaining_reference_bytes = capacity - used,
usage_percent = Math.Round(100.0 * used / capacity, 2)
},
usage_basis = "logical_object_bytes",
capacity_basis = "configured_reference_not_physical_quota",
objects = new { total = objects },
updated_at = updated
});