Saving a PDF causes a re-download of the file
Reported by
alihamze...@gmail.com,
May 27 2016
|
|||||
Issue descriptionUserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36 Example URL: Steps to reproduce the problem: 1. Open a PDF 2. Press CMD+S to save it What is the expected behavior? Chrome should save the in-memory copy, instead it (attempts) to re-download the PDF. What went wrong? When a web page uses a POST request to load a PDF file (see the Fafsa "View Student Aid Report" page) and you try to save it, Chrome fails every time with a "Failed - Network error". Did this work before? N/A Chrome version: 50.0.2661.102 Channel: stable OS Version: OS X 10.11.4 Flash Version: Shockwave Flash 21.0 r0
,
May 27 2016
Hi, I just updated to 51.0.2704.63 (64-bit) and it still has the same issue. I can't actually provide the PDF because it has a ton of personal information, but here are the steps I used to access it: 1) Go to https://fafsa.ed.gov and Login with FSA ID 2) Click "View or Print your Student Aid Report (SAR)" 3) Click the button at the top that says "View Student Aid Report (PDF)". 4) Press CMD+S and attempt to save the file I've noticed that after it fails with "Failed - Network error" I can click the little arrow and click "Resume". However, this saves the HTML version of the page as opposed to the PDF.
,
May 27 2016
I created a PHP script that can emulate the behavior. Just add any pdf to the same directory and name it "myPDF.pdf" then run the script. I just copied most of the headers from the Fafsa response but I didn't test which ones affect the saving but I'm assuming it's probably the caching.
,
May 28 2016
Thank you for providing more feedback. Adding requester "pucchakayala@chromium.org" for another review and adding "Needs-Review" label for tracking. For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
,
May 31 2016
Looking at the response headers in test.php from comment 3: "Cache-Control:max-age=0, no-cache, no-store" I believe that Chrome is doing the right thing by requesting the resource again. It doesn't explain the 'Failed - Network Error', and there is not enough info to go on. Could you collect network details at the time of failure by following these instructions: https://sites.google.com/a/chromium.org/dev/for-testers/providing-network-details
,
May 31 2016
Hi, I attached the net internals log file. As for Chrome doing the right thing, why would it re-request the document if the user wants to save the currently displayed page as is? I understand it shouldn't cache it, so if the user navigates to the page it should re-request it, but saving it with CMD+S should save what the user currently sees on the screen and not whatever the server returns on re-request.
,
Jun 1 2016
Thank you for providing more feedback. Adding "Needs-Review" label for tracking. For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
,
Jun 16 2016
I have exactly the same situation, but it's more of a problem because the SameSite cookie attribute is causing the "Save" action to download the login page (ref Issue 619603 ). My server is (as per the PHP default) setting the following headers: Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Expires: Thu, 19 Nov 1981 08:52:00 GMT Which is important, as the PDF can contain sensitive information (you need to login to view, and should not be left on disk without the user being aware). So what headers should I be using to tell Chrome to never cache the response, but still allow the user to save the PDF, without re-requesting it from the server (I should add, the PDF takes a few seconds to generate)?
,
Jun 16 2016
When saving the document, PDF plugin instructs the browser to initiate a download. Since POST is used, browser will only fetch from cache because POST is not safe for retrying. And because cache is disabled (through no-store, no-cache) for this request, there is no cache entry and the request fails. You can try using GET instead of POST.
,
Jun 16 2016
In my case I am using a GET request, and it re-requests the PDF from the website... but because of Issue 619603 , the request returns the HTML for the login page. |
|||||
►
Sign in to add a comment |
|||||
Comment 1 by pucchakayala@chromium.org
, May 27 2016Labels: Needs-Feedback