Skip to content
This repository was archived by the owner on Mar 3, 2026. It is now read-only.

fix: do not download cached files#643

Merged
stephenplusplus merged 1 commit intogoogleapis:masterfrom
stephenplusplus:spp--566
Mar 26, 2019
Merged

fix: do not download cached files#643
stephenplusplus merged 1 commit intogoogleapis:masterfrom
stephenplusplus:spp--566

Conversation

@stephenplusplus
Copy link
Copy Markdown
Contributor

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.

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Mar 26, 2019
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 26, 2019

Codecov Report

Merging #643 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #643   +/-   ##
=======================================
  Coverage   97.94%   97.94%           
=======================================
  Files           9        9           
  Lines         874      874           
  Branches       99       99           
=======================================
  Hits          856      856           
  Misses          9        9           
  Partials        9        9
Impacted Files Coverage Δ
src/file.ts 98.64% <ø> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 519ba1b...82127cc. Read the comment docs.

@stephenplusplus stephenplusplus merged commit c73d441 into googleapis:master Mar 26, 2019
@stephenplusplus stephenplusplus deleted the spp--566 branch March 26, 2019 19:02
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants