Title: [152649] trunk/Source/WebCore
Revision
152649
Author
[email protected]
Date
2013-07-15 11:22:49 -0700 (Mon, 15 Jul 2013)

Log Message

[Curl] Download does not replace existing file.
https://bugs.webkit.org/show_bug.cgi?id=118356

Patch by [email protected] <[email protected]> on 2013-07-15
Reviewed by Brent Fulgham.

If the download target file already exists, it is not replaced after the download has finished.
At this point, the user would have already approved to replace the file, so it should be replaced.

* platform/network/curl/CurlDownload.cpp:
(CurlDownload::moveFileToDestination): Move file and replace it if it already exists.
If the new file is on a different volume, do a copy/delete operation.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (152648 => 152649)


--- trunk/Source/WebCore/ChangeLog	2013-07-15 17:53:08 UTC (rev 152648)
+++ trunk/Source/WebCore/ChangeLog	2013-07-15 18:22:49 UTC (rev 152649)
@@ -1,3 +1,17 @@
+2013-07-15  [email protected]  <[email protected]>
+
+        [Curl] Download does not replace existing file.
+        https://bugs.webkit.org/show_bug.cgi?id=118356
+
+        Reviewed by Brent Fulgham.
+
+        If the download target file already exists, it is not replaced after the download has finished.
+        At this point, the user would have already approved to replace the file, so it should be replaced.
+
+        * platform/network/curl/CurlDownload.cpp:
+        (CurlDownload::moveFileToDestination): Move file and replace it if it already exists.
+        If the new file is on a different volume, do a copy/delete operation.
+
 2013-07-15  Luciano Wolf  <[email protected]>
 
         [CoordinatedGraphics] Crash at CoordinatedGraphicsScene::updateImageBacking

Modified: trunk/Source/WebCore/platform/network/curl/CurlDownload.cpp (152648 => 152649)


--- trunk/Source/WebCore/platform/network/curl/CurlDownload.cpp	2013-07-15 17:53:08 UTC (rev 152648)
+++ trunk/Source/WebCore/platform/network/curl/CurlDownload.cpp	2013-07-15 18:22:49 UTC (rev 152649)
@@ -299,7 +299,7 @@
     if (m_destination.isEmpty())
         return;
 
-    ::MoveFile(m_tempPath.charactersWithNullTermination().data(), m_destination.charactersWithNullTermination().data());
+    ::MoveFileEx(m_tempPath.charactersWithNullTermination().data(), m_destination.charactersWithNullTermination().data(), MOVEFILE_COPY_ALLOWED | MOVEFILE_REPLACE_EXISTING);
 }
 
 void CurlDownload::didReceiveHeader(const String& header)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to