[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

cblu cblu at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 06:20:12 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 49662d429bab0c775057ee97c7743532d0013080
Author: cblu <cblu at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Jun 17 19:47:26 2002 +0000

            Fix for 2939881. No more overwritting of one's files.
    
            * Misc.subproj/IFDownloadHandler.mm:
            (-[IFDownloadHandler receivedData:]):
            (-[IFDownloadHandler finishedLoading]):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@1390 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index b1a3d74..0ccacef 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,11 @@
+2002-06-17  Chris Blumenberg  <cblu at apple.com>
+
+	Fix for 2939881. No more overwritting of one's files.
+
+	* Misc.subproj/IFDownloadHandler.mm:
+	(-[IFDownloadHandler receivedData:]):
+	(-[IFDownloadHandler finishedLoading]):
+
 2002-06-17  Richard Williamson  <rjw at apple.com>
 
     Fixed IFImageViews not drawing correctly.
diff --git a/WebKit/ChangeLog-2002-12-03 b/WebKit/ChangeLog-2002-12-03
index b1a3d74..0ccacef 100644
--- a/WebKit/ChangeLog-2002-12-03
+++ b/WebKit/ChangeLog-2002-12-03
@@ -1,3 +1,11 @@
+2002-06-17  Chris Blumenberg  <cblu at apple.com>
+
+	Fix for 2939881. No more overwritting of one's files.
+
+	* Misc.subproj/IFDownloadHandler.mm:
+	(-[IFDownloadHandler receivedData:]):
+	(-[IFDownloadHandler finishedLoading]):
+
 2002-06-17  Richard Williamson  <rjw at apple.com>
 
     Fixed IFImageViews not drawing correctly.
diff --git a/WebKit/Misc.subproj/IFDownloadHandler.mm b/WebKit/Misc.subproj/IFDownloadHandler.mm
index 28874a7..9c4a352 100644
--- a/WebKit/Misc.subproj/IFDownloadHandler.mm
+++ b/WebKit/Misc.subproj/IFDownloadHandler.mm
@@ -32,14 +32,34 @@
 - (void)receivedData:(NSData *)data
 {
     NSString *path = [dataSource downloadPath];
+    NSString *pathWithoutExtension, *newPathWithoutExtension, *extension;
     NSFileManager *fileManager;
     NSWorkspace *workspace;
+    unsigned i;
     
     if(!fileHandle){
-        // FIXME: Should not replace existing file
-        // FIXME: Handle errors
         fileManager = [NSFileManager defaultManager];
-        [fileManager createFileAtPath:path contents:nil attributes:nil];
+        
+        if([fileManager fileExistsAtPath:path]){
+            pathWithoutExtension = [path stringByDeletingPathExtension];
+            extension = [path pathExtension];
+            
+            for(i=1; 1; i++){
+                newPathWithoutExtension = [NSString stringWithFormat:@"%@-%d", pathWithoutExtension, i];
+                path = [newPathWithoutExtension stringByAppendingPathExtension:extension];
+                if(![fileManager fileExistsAtPath:path]){
+                    [dataSource _setDownloadPath:path];
+                    break;
+                }
+            }
+        }
+        
+        if(![fileManager createFileAtPath:path contents:nil attributes:nil]){
+            [dataSource stopLoading];
+            // FIXME: send error
+            return;
+        }
+        
         fileHandle = [[NSFileHandle fileHandleForWritingAtPath:path] retain];
         
         workspace = [NSWorkspace sharedWorkspace];
@@ -57,9 +77,6 @@
     [fileHandle closeFile];
     WEBKITDEBUGLEVEL(WEBKIT_LOG_DOWNLOAD, "Download complete. Saved to: %s", [path cString]);
     
-    workspace = [NSWorkspace sharedWorkspace];
-    [workspace noteFileSystemChanged:path];
-    
     if([dataSource contentPolicy] == IFContentPolicyOpenExternally){
         [workspace openFile:path];
     }
diff --git a/WebKit/Misc.subproj/WebDownloadHandler.m b/WebKit/Misc.subproj/WebDownloadHandler.m
index 28874a7..9c4a352 100644
--- a/WebKit/Misc.subproj/WebDownloadHandler.m
+++ b/WebKit/Misc.subproj/WebDownloadHandler.m
@@ -32,14 +32,34 @@
 - (void)receivedData:(NSData *)data
 {
     NSString *path = [dataSource downloadPath];
+    NSString *pathWithoutExtension, *newPathWithoutExtension, *extension;
     NSFileManager *fileManager;
     NSWorkspace *workspace;
+    unsigned i;
     
     if(!fileHandle){
-        // FIXME: Should not replace existing file
-        // FIXME: Handle errors
         fileManager = [NSFileManager defaultManager];
-        [fileManager createFileAtPath:path contents:nil attributes:nil];
+        
+        if([fileManager fileExistsAtPath:path]){
+            pathWithoutExtension = [path stringByDeletingPathExtension];
+            extension = [path pathExtension];
+            
+            for(i=1; 1; i++){
+                newPathWithoutExtension = [NSString stringWithFormat:@"%@-%d", pathWithoutExtension, i];
+                path = [newPathWithoutExtension stringByAppendingPathExtension:extension];
+                if(![fileManager fileExistsAtPath:path]){
+                    [dataSource _setDownloadPath:path];
+                    break;
+                }
+            }
+        }
+        
+        if(![fileManager createFileAtPath:path contents:nil attributes:nil]){
+            [dataSource stopLoading];
+            // FIXME: send error
+            return;
+        }
+        
         fileHandle = [[NSFileHandle fileHandleForWritingAtPath:path] retain];
         
         workspace = [NSWorkspace sharedWorkspace];
@@ -57,9 +77,6 @@
     [fileHandle closeFile];
     WEBKITDEBUGLEVEL(WEBKIT_LOG_DOWNLOAD, "Download complete. Saved to: %s", [path cString]);
     
-    workspace = [NSWorkspace sharedWorkspace];
-    [workspace noteFileSystemChanged:path];
-    
     if([dataSource contentPolicy] == IFContentPolicyOpenExternally){
         [workspace openFile:path];
     }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list