2009-09-05 Nicolas Weber <thakis@chromium.org>
authoreric@webkit.org <eric@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 5 Sep 2009 09:13:31 +0000 (09:13 +0000)
committereric@webkit.org <eric@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 5 Sep 2009 09:13:31 +0000 (09:13 +0000)
        Reviewed by Darin Fisher.

        https://bugs.webkit.org/show_bug.cgi?id=28975
        Fix file upload on chrome/mac. Images that have "Hide Extension" set,
        such as screenshots by default, can now be uploaded to sites such as
        imgur.com.

        * platform/FileSystem.h:
        Add pathGetDisplayFileName().
        * platform/chromium/FileChooserChromium.cpp:
        (WebCore::FileChooser::basenameForWidth):
        Call pathGetDisplayFileName() instead of pathGetFileName().
        * platform/chromium/FileSystemChromiumLinux.cpp:
        (WebCore::pathGetDisplayFileName):
        Implement pathGetDisplayFileName() by delegating to pathGetFileName().
        * platform/chromium/FileSystemChromiumMac.mm:
        (WebCore::pathGetFileName):
        Now returns a real filename instead of a presentational one, which
        fixes the problem addressed by this change.
        (WebCore::pathGetDisplayFileName):
        New function that returns a presentational filename; does what
        pathGetDisplayFileName() did prior to this patch.
        * platform/chromium/FileSystemChromiumWin.cpp:
        (WebCore::pathGetDisplayFileName):
        Implement pathGetDisplayFileName() by delegating to pathGetFileName().

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@48095 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/platform/FileSystem.h
WebCore/platform/chromium/FileChooserChromium.cpp
WebCore/platform/chromium/FileSystemChromiumLinux.cpp
WebCore/platform/chromium/FileSystemChromiumMac.mm
WebCore/platform/chromium/FileSystemChromiumWin.cpp

index 13a0a4c..7b04f69 100644 (file)
@@ -1,3 +1,31 @@
+2009-09-05  Nicolas Weber  <thakis@chromium.org>
+
+        Reviewed by Darin Fisher.
+
+        https://bugs.webkit.org/show_bug.cgi?id=28975
+        Fix file upload on chrome/mac. Images that have "Hide Extension" set,
+        such as screenshots by default, can now be uploaded to sites such as
+        imgur.com.
+
+        * platform/FileSystem.h:
+        Add pathGetDisplayFileName().
+        * platform/chromium/FileChooserChromium.cpp:
+        (WebCore::FileChooser::basenameForWidth):
+        Call pathGetDisplayFileName() instead of pathGetFileName().
+        * platform/chromium/FileSystemChromiumLinux.cpp:
+        (WebCore::pathGetDisplayFileName):
+        Implement pathGetDisplayFileName() by delegating to pathGetFileName().
+        * platform/chromium/FileSystemChromiumMac.mm:
+        (WebCore::pathGetFileName):
+        Now returns a real filename instead of a presentational one, which
+        fixes the problem addressed by this change.
+        (WebCore::pathGetDisplayFileName):
+        New function that returns a presentational filename; does what
+        pathGetDisplayFileName() did prior to this patch.
+        * platform/chromium/FileSystemChromiumWin.cpp:
+        (WebCore::pathGetDisplayFileName):
+        Implement pathGetDisplayFileName() by delegating to pathGetFileName().
+
 2009-09-05  Joel Stanley  <joel@jms.id.au>
 
         Reviewed by David Levin.
index e23b6da..958eb73 100644 (file)
@@ -170,6 +170,10 @@ char* filenameFromString(const String&);
 String filenameForDisplay(const String&);
 #endif
 
+#if PLATFORM(CHROMIUM)
+String pathGetDisplayFileName(const String&);
+#endif
+
 } // namespace WebCore
 
 #endif // FileSystem_h
index 08d33a3..3d75b42 100644 (file)
@@ -42,7 +42,7 @@ String FileChooser::basenameForWidth(const Font& font, int width) const
     if (m_filenames.isEmpty())
         string = fileButtonNoFileSelectedLabel();
     else if (m_filenames.size() == 1)
-        string = pathGetFileName(m_filenames[0]);
+        string = pathGetDisplayFileName(m_filenames[0]);
     else
         return StringTruncator::rightTruncate(multipleFileUploadText(m_filenames.size()), width, font, false);
 
index e388dee..24f8da5 100644 (file)
@@ -38,4 +38,9 @@ String pathGetFileName(const String& path)
     return path.substring(path.reverseFind('/') + 1);
 }
 
+String pathGetDisplayFileName(const String& path)
+{
+    return pathGetFileName(path);
+}
+
 } // namespace WebCore
index 7e880e1..29563de 100644 (file)
@@ -38,6 +38,11 @@ namespace WebCore {
 
 String pathGetFileName(const String& path)
 {
+    return [path lastPathComponent];
+}
+
+String pathGetDisplayFileName(const String& path)
+{
     return [[NSFileManager defaultManager] displayNameAtPath:path];
 }
 
index 704c39a..0e605dc 100644 (file)
@@ -41,4 +41,9 @@ String pathGetFileName(const String& path)
     return String(PathFindFileName(String(path).charactersWithNullTermination()));
 }
 
+String pathGetDisplayFileName(const String& path)
+{
+    return pathGetFileName(path);
+}
+
 } // namespace WebCore