fix: display unlimited quota (∞) when storage_quota_bytes = 0

- Added formatQuotaSize() function to display ∞ for unlimited (0) quota
- Added format_quota_size() Rust function matching JavaScript behavior
- Updated quota defaulting logic from '||' to '== null' check
- This allows 0 (unlimited) to pass through while defaulting to 10 GB
  only when the value is null/undefined
- Call sites now use dedicated formatQuotaSize() or format_quota_size()
  instead of options parameter for cleaner API
This commit is contained in:
George Wu
2026-02-20 19:02:01 -08:00
parent 269a5fe940
commit 283a80a302
4 changed files with 34 additions and 7 deletions
+7
View File
@@ -23,6 +23,12 @@ function formatFileSize(bytes) {
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];
}
/// Formats a byte count for quota display. When bytes is 0, returns "∞" (unlimited).
function formatQuotaSize(bytes) {
if (bytes === 0) return '∞';
return formatFileSize(bytes);
}
function formatDateTime(value) {
if (!value) return '';
let dateValue;
@@ -58,6 +64,7 @@ function isTextViewable(mimeType) {
window.escapeHtml = escapeHtml;
window.formatFileSize = formatFileSize;
window.formatQuotaSize = formatQuotaSize;
window.formatDateTime = formatDateTime;
window.formatDateShort = formatDateShort;
window.isTextViewable = isTextViewable;