cloudflare / Stout

A reliable static website deploy tool
MIT License
752 stars 29 forks source link

On revert, old files could still be available #24

Open renandincer opened 8 years ago

renandincer commented 8 years ago

Assume this scenerio where the current files are

index.html
page2.html
page3.html
950e80e70eb0/index.html
950e80e70eb0/page2.html
950e80e70eb0/page3.html
c7ff515816e5/index.html
c7ff515816e5/page2.html

if we were to revert to c7ff515816e5 from 950e80e70eb0, page3.html would remain visible on the website. This is happening because in the source the contents of the version is being copied to the root with replace but not checking for already existing files.

renandincer commented 8 years ago

One way to fix this could be finding out the latest deploy, removing the files that don't exist anymore in the new version after deploying the new version. [After deploy, list all html files, remove files that was not part of that deploy] But this might be an issue if there are .html files in the bucket that is not managed by Stout. Maybe add a --clean-up flag to indicate this behavior.

Another way of fixing this is finding out the currently active deploy (maybe through a file that keeps track of state in the bucket), diffing the files between the deploy to be restored and the current deploy and deleting the ones removed during this change.