Changeset 87704 in webkit


Ignore:
Timestamp:
May 30, 2011 6:44:55 PM (13 years ago)
Author:
eric.carlson@apple.com
Message:

2011-05-30 Eric Carlson <eric.carlson@apple.com>

Reviewed by Alexey Proskuryakov.

Audio and video files saved to the Application Cache should preserve the original file extension
https://bugs.webkit.org/show_bug.cgi?id=61750
<rdar://9524922>

No new tests, it isn't possible to check the name of the file in the cache from within
DRT. Changes verified manually.

  • loader/appcache/ApplicationCacheStorage.cpp: (WebCore::ApplicationCacheStorage::store): Append the original file extension to the cache

file name.

(WebCore::ApplicationCacheStorage::writeDataToUniqueFileInDirectory): Add extension parameter.

  • loader/appcache/ApplicationCacheStorage.h:
Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r87703 r87704  
     12011-05-30  Eric Carlson  <eric.carlson@apple.com>
     2
     3        Reviewed by Alexey Proskuryakov.
     4
     5        Audio and video files saved to the Application Cache should preserve the original file extension
     6        https://bugs.webkit.org/show_bug.cgi?id=61750
     7        <rdar://9524922>
     8
     9        No new tests, it isn't possible to check the name of the file in the cache from within
     10        DRT. Changes verified manually.
     11
     12        * loader/appcache/ApplicationCacheStorage.cpp:
     13        (WebCore::ApplicationCacheStorage::store): Append the original file extension to the cache
     14            file name.
     15        (WebCore::ApplicationCacheStorage::writeDataToUniqueFileInDirectory): Add extension parameter.
     16        * loader/appcache/ApplicationCacheStorage.h:
     17
    1182011-05-30  Jer Noble  <jer.noble@apple.com>
    219
  • trunk/Source/WebCore/loader/appcache/ApplicationCacheStorage.cpp

    r86397 r87704  
    804804        String flatFileDirectory = pathByAppendingComponent(m_cacheDirectory, flatFileSubdirectory);
    805805        makeAllDirectories(flatFileDirectory);
     806
     807        String extension;
     808       
     809        String fileName = resource->response().suggestedFilename();
     810        size_t dotIndex = fileName.reverseFind('.');
     811        if (dotIndex != notFound && dotIndex < (fileName.length() - 1))
     812            extension = fileName.substring(dotIndex);
     813
    806814        String path;
    807         if (!writeDataToUniqueFileInDirectory(resource->data(), flatFileDirectory, path))
     815        if (!writeDataToUniqueFileInDirectory(resource->data(), flatFileDirectory, path, extension))
    808816            return false;
    809817       
     
    12321240}
    12331241   
    1234 bool ApplicationCacheStorage::writeDataToUniqueFileInDirectory(SharedBuffer* data, const String& directory, String& path)
     1242bool ApplicationCacheStorage::writeDataToUniqueFileInDirectory(SharedBuffer* data, const String& directory, String& path, const String& fileExtension)
    12351243{
    12361244    String fullPath;
    12371245   
    12381246    do {
    1239         path = encodeForFileName(createCanonicalUUIDString());
     1247        path = encodeForFileName(createCanonicalUUIDString()) + fileExtension;
    12401248        // Guard against the above function being called on a platform which does not implement
    12411249        // createCanonicalUUIDString().
  • trunk/Source/WebCore/loader/appcache/ApplicationCacheStorage.h

    r82000 r87704  
    116116    bool shouldStoreResourceAsFlatFile(ApplicationCacheResource*);
    117117    void deleteTables();
    118     bool writeDataToUniqueFileInDirectory(SharedBuffer*, const String& directory, String& outFilename);
     118    bool writeDataToUniqueFileInDirectory(SharedBuffer*, const String& directory, String& outFilename, const String& fileExtension);
    119119
    120120    void loadManifestHostHashes();
Note: See TracChangeset for help on using the changeset viewer.