Form data lost after failed save
Submitted by Adam Nielsen
Link to original bug (#747897)
Description
When trying to save a file over the top of a read-only PDF, any form data that has been filled out is erroneously wiped. It works fine if the PDF files are read/write, the data is only silently lost after a failed save operation due to the inability to open the read-only file for writing.
Steps to reproduce:
-
Open a read-only PDF file with fields, e.g. http://www.qcat.qld.gov.au/__data/assets/pdf_file/0017/100844/credit-card-payment-auth.pdf
-
Observe the permissions on the .pdf are 400 (-r--------, in my case set by Firefox opening the download.) If this is not the case, set the perms to 400 and reopen.
-
Fill out some form data.
-
Save the file under a new name. Observe the save is successful, and the perms are copied so the new file is also 400. This is all fine.
-
Fill out some more form data.
-
Save the file again, overwriting the file in step 4. Observe you will get an error saying the file is read only. At this point any data entered in step 5 lost. The data is still visible on the screen, but you are unable to save it. Evince has silently reopened the file, reverting the data back to what was saved in step 4. Sometimes it even reverts back to what was in the file in step 1, i.e. a completely blank form! (Seems to depend on which file was originally opened before the first save operation.)
What should happen:
When a save operation fails, data should not be lost. The file should not be reverted to the last saved copy, so that the user is given the chance to save a second time.
Version: 3.16.x