github GeiserX/Wayback-Archive v1.4.3

2 hours ago

Archives now reproduce the site. Six defects meant the saved copy referenced files that were never written — and in the worst case, that most of the site was never written at all.

Upgrade and re-archive. If you archived a site with directory-style URLs (/blog/, /about/) on any earlier version, that archive is incomplete — those pages overwrote each other.

A multi-page site archived down to one file

A trailing-slash URL replaced the whole output path with index.html, so /blog/ and /about/ both wrote to the root index.html, overwriting each other and the home page. A root + blog + about site left exactly one file, containing whichever page finished last. Directory pages now land in blog/index.html and about/index.html.

Inline styles kept calling the live site

style="background:url(...)" was only rewritten for Wayback-form URLs, so a plain url(http://site/bg.png) was downloaded and then never referenced — the archived page still pointed at the live internet. It now goes through the same rewriter as <style> blocks and .css files.

Links did not always name the file

Four ways a reference could point at nothing:

  • a file saved as a#b.png was linked as a#b.png, which a browser reads as a fragment; ? broke the same way as a query string
  • a stylesheet's url() was made relative to the last HTML page processed rather than to the stylesheet, so assets/site.css emitted ../../../i/tile.png
  • a CDN root URL, stored as index.html inside its domain folder, was linked to the folder
  • an extensionless asset such as /image/12345, stored as image/12345.html, was linked without the suffix

All four had one cause: the code deciding where a file goes and the code writing the link to it were separate copies that had drifted. The link builder now asks for the stored path instead of working it out again, so the two cannot disagree. That replaced 87 lines of duplicated resolution logic with 49, and removed a third copy used for CSS and data-* attributes.

Verification

A sweep over 28 URL shapes across 4 page locations and both reference kinds — 232 combinations — resolves every link to the file that gets written. End to end, a site with nested directory pages, spaces, #, non-ASCII, an inline style, a <style> block and an external stylesheet produces 4 files and 11 references that all resolve inside the output directory; before, it produced 1 file and no references at all.

Known limit

An extensionless asset is still named .html, because nothing knows its content type until after the referring page has been rewritten. Links resolve and the archive works opened from disk, but a strict web server would serve such a stylesheet as text/html. A fix is in progress.

Don't miss a new Wayback-Archive release

NewReleases is sending notifications on new releases.