Skip to content

Web UI: file list is silently truncated at 20 with no way to expand, and unit labels don't match the math (GB/MB shown for GiB/MiB values) #92

Description

@RedlineGT

Two small but real bugs in the web UI (internal/assets/static/js/app.js), found while comparing it against a companion HF-cache-consolidation tool we built to complement this project.

1. File list truncates at 20 with no expand affordance

Three separate render sites truncate a repo's file list at 20 and render a static, non-interactive ... and N more files div with no click handler:

  • renderAnalysisResult() (Analyze card)
  • updateFileListFromSelections() (selection-filtered Analyze view)
  • showCacheDetails() (Local Cache detail modal)

For any repo with more than 20 files (e.g. black-forest-labs/FLUX.1-schnell, 28 files), there is currently no way to see the rest of the file list from the UI at all - you have to already know the filename you want.

2. formatBytes() mislabels binary-prefix math as decimal-prefix units

function formatBytes(bytes) {
  if (!bytes || bytes === 0) return '0 B';
  const k = 1024;
  const sizes = ['B', 'KB', 'MB', 'GB', 'TB'];  // <-- decimal-prefix labels
  const i = Math.floor(Math.log(bytes) / Math.log(k));  // <-- but 1024-based math
  return parseFloat((bytes / Math.pow(k, i)).toFixed(1)) + ' ' + sizes[i];
}

The math is base-1024 (correct for binary sizes), but the unit strings are decimal-prefix (KB/MB/GB/TB instead of KiB/MiB/GiB/TiB). The server-supplied size_human field is already correctly labeled and is preferred where available, but every place with no server string - most notably live download speed and progress, which are computed client-side from raw byte counts with no size_human fallback - inherits the mislabel. In practice this means an active download's speed/progress readout is always understating its own precision (e.g. displaying "45.2 MB/s" for a value that is really MiB/s, roughly a 5% numeric overstatement relative to what the label claims).

Fix

Both are small, isolated fixes:

  1. Relabel sizes to ['B', 'KiB', 'MiB', 'GiB', 'TiB'] (one line).
  2. Add an expand/collapse toggle in place of the static "more files" text at all three render sites, reusing a small shared render helper.

I have both fixed and verified locally (go build clean, fix exercised live against black-forest-labs/FLUX.1-schnell - toggle correctly expands from 20 to all 28 files and collapses back). Happy to open a PR with just these two isolated fixes if that's useful - didn't want to open one unsolicited without checking first, since I know #91 already covers the broader flat-file/output-path direction this project might be headed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions