Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: do not download cached files #643

Merged
merged 1 commit into from
Mar 26, 2019

Conversation

stephenplusplus
Copy link
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

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 join this conversation on GitHub. Already have an account? Sign in to comment
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