Bug 206271

Summary: okular creates(erases) empty file when "Save As..." to original file
Product: [Applications] okular Reporter: Cobra176
Component: generalAssignee: Okular developers <okular-devel>
Status: RESOLVED DUPLICATE    
Severity: normal    
Priority: NOR    
Version: 0.8.2   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:

Description Cobra176 2009-09-04 19:27:37 UTC
Version:           0.8.2 (using 4.2.2 (KDE 4.2.2), Kubuntu packages)
Compiler:          cc
OS:                Linux (x86_64) release 2.6.28-13-generic

okular creates(erases) empty file when "Save As..." to original file

Steps to reproduce:
1. Open a PDF file with Okular.
2. Select File->Save As...
3. In the save dialog, select the same file which was loaded.
4. Viewer will go gray and message will show that document is being reloaded but document will not reload.
5. Check the file's properties with your favorite file manager. Size is now zero, the original PDF has been lost.

Expected behavior:
Okular should save the file to the opened file just as it would if Save As... was applied to any other file name. File should reload fine.

Purpose:
Sometimes it is nice to use a viewer to load and re-write PDF files to ensure that PDFs which may have buggy code are uniform and can be read on other viewers.
Comment 1 Albert Astals Cid 2009-09-13 23:23:37 UTC
Your idea of rewriting is not what Okular does on save as, it just copies byte per byte the file so it won't do what you want, but now at least i've fixed that you won't loose the file on saving over itself.

Thanks for caring about okular and reporting this bug.

*** This bug has been marked as a duplicate of bug 207214 ***