Fix saving annotations to gzipped files
ClosedPublic

Authored by rkflx on Dec 31 2017, 3:03 PM.

Details

Summary

Okular supports opening zipped files like document.pdf.gz by
transparently extracting them. However, since 559836c39270 saving
annotations back was broken. This is because this commit tries to
prevent saving back changes to externally modified files to prevent data
loss. The way this is checked by comparing timestamps mistakenly
triggered for unchanged zipped files, too.

This can be solved by always comparing the before/after timestamps of
the actual file, instead of the timestamp of the temporary copy of the
extracted file. The change has to be done in two places so saving
repeatedly works too.

BUG: 338742

Test Plan
  • gzip autotests/data/file1.pdf && okular file1.pdf.gz
  • Add annotation, saving works now instead of showing an error.
  • touch normal.pdf still triggers modification warning.

Diff Detail

Repository
R223 Okular
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
rkflx created this revision.Dec 31 2017, 3:03 PM
Restricted Application added a project: Okular. · View Herald TranscriptDec 31 2017, 3:03 PM
Restricted Application added a subscriber: Okular. · View Herald Transcript
rkflx requested review of this revision.Dec 31 2017, 3:03 PM
rkflx added a reviewer: Okular.Jan 1 2018, 7:34 AM
aacid requested changes to this revision.Jan 2 2018, 4:48 PM

Do you think you could add an autotest so this doesn't regress in the future?

This revision now requires changes to proceed.Jan 2 2018, 4:48 PM
rkflx added a comment.Jan 2 2018, 5:07 PM
In D9580#185022, @aacid wrote:

Do you think you could add an autotest so this doesn't regress in the future?

I can try, but probably won't happen in time for 17.12.1 (sorry).

aacid accepted this revision.Feb 5 2018, 11:31 PM
This revision is now accepted and ready to land.Feb 5 2018, 11:31 PM
This revision was automatically updated to reflect the committed changes.