GNOME Bugzilla – Bug 721726
Partial file left on disk when download is canceled
Last modified: 2014-01-09 10:42:47 UTC
* Start downloading a big file. * Try to close Epiphany. When presented with a warning dialog to indicate that your active download will be canceled, click close anyway. The partially-downloaded file is left on disk. Since the file is unusable and this could confuse the user, I would expect it to be removed.
I think it probably shouldn't write to the final destination directly anyway. I prefer the way other browsers create a "lock" file in the final location, download to a "partial" file, and only move the download into the final location when it is completed.
(In reply to comment #1) > I think it probably shouldn't write to the final destination directly anyway. > > I prefer the way other browsers create a "lock" file in the final location, > download to a "partial" file, and only move the download into the final > location when it is completed. This should probably be done by WebKit.
(In reply to comment #2) > (In reply to comment #1) > > I think it probably shouldn't write to the final destination directly anyway. > > > > I prefer the way other browsers create a "lock" file in the final location, > > download to a "partial" file, and only move the download into the final > > location when it is completed. > > This should probably be done by WebKit. Actually, webkit already does that, it uses g_file_replace() for exactly that reason, see g_file_replace docs: "This will try to replace the file in the safest way possible so that any errors during the writing will not affect an already existing copy of the file. For instance, for local files it may write to a temporary file and then atomically rename over the destination when the stream is closed."
Ok, I've fixed this in webkit in the end, see https://bugs.webkit.org/show_bug.cgi?id=126686