Danbooru

Broken image cached in CF on API URL only

Posted under Bugs & Features

There is this post #5455433 which appears to have cached a corrupted copy in CF, but only on the URL provided by the API.

The file served by the frontend is https://cdn.donmai.us/original/7f/20/__mizuki_arknights_drawn_by_zhuang_yao__7f2089e04681556ae058d510f4b955e9.gif
This file has the md5sum 7f2089e04681556ae058d510f4b955e9, which matched what the API exposes as well as the name of the file.

However, the file served by https://cdn.donmai.us/original/7f/20/7f2089e04681556ae058d510f4b955e9.gif, which should be the same file, is corrupted and has a different md5sum 892254036bfd0f1e7a9254f0f036a938. This is the URL the API provides.

Bypassing the CF cache by adding a query parameter, e.g. https://cdn.donmai.us/original/7f/20/7f2089e04681556ae058d510f4b955e9.gif?asd=123 returns a fresh, non-corrupt file, with the correct md5.

This may well be a spurious error that resolves itself once the API URL gets evicted from the cache and refreshed, especially since bypassing the cache returns the correct file and I've only run into this issue on this particular post.

Interestingly, both the real file and the corrupted version have the exact same file-sizes.
I have both headers and the response body for the corrupted file, as well as for the bypassed one, in case someone wants it for debugging.

1