diff options
-rw-r--r-- | ChangeLog | 10 | ||||
-rw-r--r-- | embed/mozilla/EphyHeaderSniffer.cpp | 15 | ||||
-rw-r--r-- | src/popup-commands.c | 2 |
3 files changed, 24 insertions, 3 deletions
@@ -1,3 +1,13 @@ +2004-02-24 Xan Lopez <xan@gnome.org> + + * embed/mozilla/EphyHeaderSniffer.cpp: + + Unescape filenames whenever possible. + + * src/popup-commands.c: (save_property_url): + + Nitpick. + 2004-02-24 Christian Persch <chpe@cvs.gnome.org> * src/ephy-nautilus-view.c: (gnv_embed_new_window_cb): 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); diff --git a/src/popup-commands.c b/src/popup-commands.c index 6a2280b82..6d90abe7a 100644 --- a/src/popup-commands.c +++ b/src/popup-commands.c @@ -291,7 +291,7 @@ save_property_url (GtkAction *action, ephy_embed_persist_set_embed (persist, embed); ephy_embed_persist_set_fc_title (persist, title); - ephy_embed_persist_set_fc_parent (persist,GTK_WINDOW (window)); + ephy_embed_persist_set_fc_parent (persist, GTK_WINDOW (window)); ephy_embed_persist_set_flags (persist, ask_dest ? EMBED_PERSIST_ASK_DESTINATION : 0); ephy_embed_persist_set_persist_key |