Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1240)

Unified Diff: third_party/WebKit/WebCore/platform/chromium/ClipboardChromium.cpp

Issue 20504: I'm expanding this to fix a couple of bugs in determining the file name for... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/WebCore/platform/chromium/ClipboardChromium.cpp
===================================================================
--- third_party/WebKit/WebCore/platform/chromium/ClipboardChromium.cpp (revision 10151)
+++ third_party/WebKit/WebCore/platform/chromium/ClipboardChromium.cpp (working copy)
@@ -268,13 +268,14 @@
// use the alt tag if one exists, otherwise we fall back on the suggested
// filename in the http header, and finally we resort to using the filename
// in the URL.
- dataObject->fileExtension = ".";
- dataObject->fileExtension += MIMETypeRegistry::getPreferredExtensionForMIMEType(
- cachedImage->response().mimeType());
+ String extension = MIMETypeRegistry::getPreferredExtensionForMIMEType(
+ cachedImage->response().mimeType());
+ dataObject->fileExtension = extension.isEmpty() ? "" : "." + extension;
String title = element->getAttribute(altAttr);
- if (title.isEmpty()) {
+ if (title.isEmpty())
title = cachedImage->response().suggestedFilename();
- }
+
+ title = ClipboardChromium::validateFileName(title, dataObject);
dataObject->fileContentFilename = title + dataObject->fileExtension;
}

Powered by Google App Engine
This is Rietveld 408576698