Changeset 1883 for branches/eraser6/6.0


Ignore:
Timestamp:
03/06/10 08:29:48 (4 years ago)
Author:
lowjoel
Message:

Potential fix for the "Insufficient disk space" error when deleting files securely. My hypothesis is that invalidly-named files cause the file system to allocate file entries differently (we rename the same file with a name of the same length to eliminate reallocation of MFT entries) so this patch will fix that, ensuring filenames are always valid.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eraser6/6.0/Eraser.Manager/FileSystem.cs

    r1878 r1883  
    6666                    "ABCDEFGHIJKLMNOPQRSTUVWXYZ _+=-()[]{}',`~!"; 
    6767                for (int j = 0, k = resultAry.Length; j < k; ++j) 
     68                { 
    6869                    resultAry[j] = (byte)validFileNameChars[ 
    6970                        (int)resultAry[j] % validFileNameChars.Length]; 
     71 
     72                    if (j == 0 || j == k - 1) 
     73                        //The first or last character cannot be whitespace 
     74                        while (Char.IsWhiteSpace((char)resultAry[j])) 
     75                            resultAry[j] = (byte)validFileNameChars[ 
     76                                (int)resultAry[j] % validFileNameChars.Length]; 
     77                } 
    7078 
    7179                result = Encoding.UTF8.GetString(resultAry); 
Note: See TracChangeset for help on using the changeset viewer.