This repository was archived by the owner on Mar 3, 2026. It is now read-only.
Commit c73d441
authored
fix: do not download cached files (#643)
Fixes #566
To quickly sum up the issue discovered in #566, this works:
- Save file with contents 'a'
- Download file. Contents === 'a'
- Save file with contents 'b'
- Download file. Contents === 'b' 😄
But as soon as it's a public file, it doesn't work:
- Save file with contents 'a'
- Make file public
- Download file. Contents === 'a'
- Save file with contents 'b'
- Download file. Contents === 'a' 😢
I believe what happens when the file is flipped to a public object, we then have to worry about caching. When you update the file, the upstream API's `generation` property is updated as well for the Object record.
So far, I've found three solutions:
- Ensure the file we download will not be cached (`Cache-Control: no-store`)
- Set `Cache-Control: no-transform` on the file's metadata
- Send the download API request with the latest `generation` in the query
I went with the first, as it seems the least error-prone.1 parent 519ba1b commit c73d441
2 files changed
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1160 | 1160 | | |
1161 | 1161 | | |
1162 | 1162 | | |
| 1163 | + | |
1163 | 1164 | | |
1164 | 1165 | | |
1165 | 1166 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
833 | 833 | | |
834 | 834 | | |
835 | 835 | | |
| 836 | + | |
836 | 837 | | |
837 | 838 | | |
838 | 839 | | |
| |||
0 commit comments