Article · python / static-site / cli
The file is there. Why is the image missing?
Precheck missing static assets and filename case differences offline with AssetCase; keep coverage limits and browser retesting explicit.
You are preparing a small website for delivery. The page opens and its text looks fine, but the logo is missing. You inspect the output directory and find the image exactly where you expected. Before clearing the browser cache again, there is a smaller question to answer: does the path requested by the HTML have exactly the same spelling as the file that was shipped?
Suppose the document requests assets/logo.png while the output contains assets/Logo.png. These look almost identical to a person reading quickly. A difference that went unnoticed in one environment can become visible with a different filesystem or server configuration. A successful local preview does not establish that the deployed path is correct. File existence and the exact spelling of each path component deserve separate attention.
There is no single case rule for every part of a URL. Scheme and host rules differ from path rules, as RFC 3986 explains. For this precheck, AssetCase does not silently equate logo.png with Logo.png. It first looks for an exact directory entry, then reports differently spelled candidates separately. A server's particular behavior still needs its own verification.
Precheck with AssetCase
AssetCase is a small offline Python CLI for that narrow task. It reads regular HTML files inside a selected static output root and checks img src, script src and stylesheet link href references. It uses the Python standard library without extra packages. It makes no network requests, runs no shell commands and changes no input files. Image, CSS and JavaScript bodies are not opened; their names and metadata are checked.
The root must be chosen deliberately. In pages/about.html, ../assets/logo.png starts from the document's directory. A reference to /assets/logo.png starts from the static root passed to the command, rather than the operating-system root. Selecting the full dist directory is different from selecting only its pages subdirectory. A site hosted under a URL subpath also needs a separate review of its build base-path setting.
Query and fragment values are removed before matching. For logo.png?v=2#preview, the requested file is logo.png; those values do not enter the report. Percent decoding happens once with strict UTF-8, so a%20b.png can address a filename containing a space. A plus stays a plus. Invalid percent sequences and encoded separators are reported as incomplete rather than repaired through a guessed interpretation.
Run the synthetic example
From the tool directory, run python3 -B assetcase.py examples/demo. The synthetic fixture contains four local references. It reports case_mismatch for assets/logo.png with assets/Logo.png as the candidate, and missing for assets/hero.png. The stylesheet and script paths are exact. The summary is checked=4, excluded=0 and exit code 1. This example is generated test data, not a customer-site assessment.
When more than one case candidate exists, the result is ambiguous. Logo.png and logo.PNG do not provide a unique answer to a request for LOGO.PNG. Unicode normalization differences are not silently merged either; normalization-only candidates make the check incomplete. The developer must decide which spelling belongs in the output. AssetCase exposes that decision without renaming a file or editing a document.
After reviewing a finding, correct the HTML reference, the filename or the build copy step yourself. Regenerate the static output and run the same command again. The separate examples/fixed fixture demonstrates four exact results and exit 0. The scanner does not transform the original demo. Open the page in a browser afterward to confirm that the image decodes, loads and appears in the intended layout.
Read the result and limits
Exit 0 means only that supported local path checks found no issues. Remote and data references are counted as not checked, so a document can return 0 with checked=0. Exit 1 means path findings. Exit 2 means invalid, unsupported, unreadable or limited input; it takes priority over 1 while preserving findings. Automation should inspect checked, excluded and issues alongside the code, rather than treating every completed invocation as a successful review.
Any base element makes ordinary local resolution incomplete, because a base URL can change reference interpretation, as the HTML standard describes. Srcset and visible inline CSS URLs are also reported as unsupported coverage. CSS file contents, dynamic JavaScript, framework routing and server rewrites are not evaluated. Every report includes those limitations. An exact stylesheet path does not verify its background images.
Symlinks are not followed and root escapes are rejected. Fixed file, size, total-read and reference limits bound the work; hitting a limit never produces a clean result. This release was tested with synthetic acceptance cases on Linux and Python 3.14.9. Windows and macOS were not tested. Use a stable, trusted local snapshot; the tool is not a sandbox against hostile concurrent filesystem changes.
Existing alternatives
Existing alternatives include htmltest for broader generated-HTML checks and Lychee's local-folder workflow for local roots and URL mapping. AssetCase makes no uniqueness claim. Its purpose is a repeatable small precheck before delivery. Content review, security assessment and browser verification remain separate work, even when every supported path is exact.
Download the MIT-licensed AssetCase package; the usage guides and source code are available on GitHub.