aboutsummaryrefslogtreecommitdiffstats
path: root/embed/mozilla
diff options
context:
space:
mode:
authorXan Lopez <xan@src.gnome.org>2004-02-25 03:59:00 +0800
committerXan Lopez <xan@src.gnome.org>2004-02-25 03:59:00 +0800
commitde0c483b6db034cf0ad1590318a537ab5043b490 (patch)
tree61f5a9511322f0d1f3ec298431b80a8428f1df75 /embed/mozilla
parent881bfd24e673370efefc8f5ceb3cec3afa9e44bc (diff)
downloadgsoc2013-epiphany-de0c483b6db034cf0ad1590318a537ab5043b490.tar
gsoc2013-epiphany-de0c483b6db034cf0ad1590318a537ab5043b490.tar.gz
gsoc2013-epiphany-de0c483b6db034cf0ad1590318a537ab5043b490.tar.bz2
gsoc2013-epiphany-de0c483b6db034cf0ad1590318a537ab5043b490.tar.lz
gsoc2013-epiphany-de0c483b6db034cf0ad1590318a537ab5043b490.tar.xz
gsoc2013-epiphany-de0c483b6db034cf0ad1590318a537ab5043b490.tar.zst
gsoc2013-epiphany-de0c483b6db034cf0ad1590318a537ab5043b490.zip
Unescape filenames whenever possible.
Unescape filenames whenever possible.
Diffstat (limited to 'embed/mozilla')
-rw-r--r--embed/mozilla/EphyHeaderSniffer.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/embed/mozilla/EphyHeaderSniffer.cpp b/embed/mozilla/EphyHeaderSniffer.cpp
index a37c9164c..136a40325 100644
--- a/embed/mozilla/EphyHeaderSniffer.cpp
+++ b/embed/mozilla/EphyHeaderSniffer.cpp
@@ -303,6 +303,15 @@ nsresult EphyHeaderSniffer::PerformSave (nsIURI* inOriginalURI)
const char *key;
key = ephy_embed_persist_get_persist_key (EPHY_EMBED_PERSIST (mEmbedPersist));
+ char *filename;
+ filename = gnome_vfs_unescape_string (NS_ConvertUCS2toUTF8 (defaultFileName).get(), NULL);
+
+ if (!g_utf8_validate (filename, -1, NULL))
+ {
+ g_free (filename);
+ filename = g_strdup (NS_ConvertUCS2toUTF8(defaultFileName).get());
+ }
+
if (askDownloadDest)
{
EphyFileChooser *dialog;
@@ -319,19 +328,21 @@ nsresult EphyHeaderSniffer::PerformSave (nsIURI* inOriginalURI)
key ? key : CONF_STATE_SAVE_DIR);
gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dialog),
- NS_ConvertUCS2toUTF8 (defaultFileName).get());
+ filename);
g_signal_connect (dialog, "response",
G_CALLBACK (filechooser_response_cb), this);
gtk_widget_show (GTK_WIDGET (dialog));
+ g_free (filename);
return NS_OK;
}
/* FIXME: how to inform user of failed save ? */
nsCOMPtr<nsILocalFile> destFile;
- BuildDownloadPath (NS_ConvertUCS2toUTF8 (defaultFileName).get(), getter_AddRefs (destFile));
+ BuildDownloadPath (filename, getter_AddRefs (destFile));
+ g_free (filename);
NS_ENSURE_TRUE (destFile, NS_ERROR_FAILURE);
return InitiateDownload (destFile);