PlaidWeb / Publ

Flexible publishing system for the web
http://publ.beesbuzz.biz/
MIT License
40 stars 4 forks source link

Avoid collisions in asset identifiers, including extreme edge cases #540

Closed fluffy-critter closed 1 year ago

fluffy-critter commented 1 year ago

Summary

When multiple indexed assets have matching asset identifiers, increase the content hash size until it doesn't collide. Fixes #537

Detailed description

There are certain edge cases where multiple assets can end up colliding with each other in the asset path, for example:

Each of those cases could cause the link resolver to add multiple different asset items with the same asset identifier, which would cause the link resolver to fail.

This change modifies the asset identifier in two ways:

The file path shorthash cuts down on the possibility that different files with the same md5sum will swap URLs between site reindexes; the possibility still isn't 0, but it's way less likely now.

Developer/user impact

This change means that existing external links to asset files will probably become invalid, but asset links aren't intended to be stable to begin with.

Test plan

See dupe assets.md

Got a site to show off?