Bug 402529 - ark's builtin PDF viewer erases the file after save as
Summary: ark's builtin PDF viewer erases the file after save as
Status: RESOLVED FIXED
Alias: None
Product: ark
Classification: Applications
Component: general (show other bugs)
Version: 18.08.1
Platform: openSUSE Linux
: HI normal
Target Milestone: ---
Assignee: David Faure
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-12-24 14:20 UTC by David Faure
Modified: 2019-01-15 18:00 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Faure 2018-12-24 14:20:24 UTC
SUMMARY
The embedded PDF viewer incorrectly deletes the file saved by the user.

STEPS TO REPRODUCE
1. launch ARK and open a ZIP file containing a PDF
2. click on the PDF, an embedded viewer appears (okularpart inside ark, right?)
3. From that embedded PDF viewer, use "Save As..." to save the PDF somewhere on your local disk
4. Close the embedded viewer, close ark

OBSERVED RESULT
The file that you saved, gets deleted !!!

EXPECTED RESULT
The file should not be deleted, the user put it there.
This leads to an extremely frustrating user experience.

SOFTWARE/OS VERSIONS
Linux OpenSUSE Leap 15.0
KDE Plasma Version: 5.13.90
KDE Frameworks Version: 5.50
Qt Version: 5.11.2

ADDITIONAL INFORMATION
I suppose this happens because initially okularpart is opened on a temporary file, so Ark wants to delete the file afterwards. But it should do that using the initial path, not the one that okulartpart contains at the end of the operation (which might have changed due to "Save As").
Comment 1 David Faure 2019-01-14 22:15:32 UTC
Fix pending in https://phabricator.kde.org/D18256
Comment 2 David Faure 2019-01-15 18:00:07 UTC
Git commit d412ca6255230d809aa550891f1af9049cf092d9 by David Faure.
Committed on 15/01/2019 at 18:00.
Pushed by dfaure into branch 'Applications/18.12'.

Remember part URL to delete the tempfile even if the user used save as.

Summary:
Using the part URL at closing time is really dangerous: if the user used
"save as" (e.g. for an embedded PDF), we'll be deleting the file that
the user just saved!!

Test Plan:
launch ARK and open a ZIP file containing a PDF, click on the PDF,
an embedded viewer appears. From there, use "Save As..." to save the PDF
somewhere on your local disk. Close the embedded viewer, close ark.
It doesn't delete the saved file anymore.

Reviewers: elvisangelaccio, broulik

Reviewed By: elvisangelaccio

Subscribers: kde-utils-devel, #ark

Tags: #ark

Differential Revision: https://phabricator.kde.org/D18256

M  +3    -3    part/arkviewer.cpp
M  +1    -0    part/arkviewer.h

https://commits.kde.org/ark/d412ca6255230d809aa550891f1af9049cf092d9