Open edemaine opened 7 years ago
In our testing, Chrome and Safari will refresh when the image has a Cache-Control: no-store
header; see
this Chromium report. Unfortunately, this is not true for Firefox, so not really an option...
Jeffrey suggested embedding using <object>
tags, which seems to avoid the special "ignore higher-layer caching flag" behavior of the HTML standard. Unfortunately, <object>
s (at least on Chrome, despite what the spec says) seem to represent images as embedded documents, which means they don't scale the image correctly. (Large images get clipped, with possible scrollbars.) So this isn't an option either.
We also discussed using this hack to display one image (internal URL) but cause right clicks to bind to the other image (desired public-facing URL). This trick requires knowing the width and height of the image, though, so it's difficult with current Coauthor infrastructure (which doesn't know this information at the database level).
I've therefore opted for Doin's solution 4 (reload via iframe). It actually seems to work...
This bug is back in Chromium 74.0.3729.169 (it works fine in Firefox 67.0)
In Firefox 72.0.2, when I replace a file, the file is briefly replaced with some text (that says "updating", I think), then the original image is shown again. Refreshing the page does not fix it.
As a workaround, the history view shows the most recent image.
I set Cache-Control: stale-while-revalidate
so this should now be fixed. At least, it fixed my local Firefox testing -- I had trouble reproducing the original problem on Chrome. Let me know if you run into this issue again.
Still happens in Chromium :(
Since July 2021, this should happen "a lot less", on Chrome and Firefox. But I still see it happen occasionally. ☹️
I made some more tweaks to this. I'm hoping that it's actually fixed now. Let me know if you observe otherwise.
Now that URLs to files are based on message ID without any version number (#77), updating the file requires a refresh of the same URL (otherwise, the old image still appears until refreshing the page).
Related: Refresh image with a new one at the same url. Yuck.
Should URLs have a version number in all cases? E.g.
/file/messageID?v=5
? Version could default to latest, and I guess?v=5
could be stripped when dragging... For this to work, would probably need #34.