aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--embed/mozilla/EphyHeaderSniffer.cpp17
2 files changed, 14 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index 8808291ff..d944a0226 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2004-03-05 Christian Persch <chpe@cvs.gnome.org>
+ * embed/mozilla/EphyHeaderSniffer.cpp:
+
+ Replace filename validity check, it was making the filename invalid
+ UTF-16. Simply convert to UTF-8 beforehand and check for "/" chars.
+
+2004-03-05 Christian Persch <chpe@cvs.gnome.org>
+
* src/ephy-tab.c: (ephy_tab_address_cb), (ephy_tab_title_cb),
(ensure_page_info), (ephy_tab_net_state_cb),
(clipboard_text_received_cb), (ephy_tab_dom_mouse_click_cb),
diff --git a/embed/mozilla/EphyHeaderSniffer.cpp b/embed/mozilla/EphyHeaderSniffer.cpp
index 80eca4174..68e51ca6c 100644
--- a/embed/mozilla/EphyHeaderSniffer.cpp
+++ b/embed/mozilla/EphyHeaderSniffer.cpp
@@ -332,26 +332,23 @@ nsresult EphyHeaderSniffer::PerformSave (nsIURI* inOriginalURI)
}
/* Validate the file name to ensure legality. */
- for (PRUint32 i = 0; i < defaultFileName.Length(); i++)
- {
- if (defaultFileName[i] == ':' || defaultFileName[i] == '/')
- {
- defaultFileName.SetCharAt(i, PRUnichar(' '));
- }
- }
+ char *default_name = g_strdup (NS_ConvertUCS2toUTF8 (defaultFileName).get());
+ default_name = g_strdelimit (default_name, "/", ' ');
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);
-
+ filename = gnome_vfs_unescape_string (default_name, NULL);
+
if (!g_utf8_validate (filename, -1, NULL))
{
g_free (filename);
- filename = g_strdup (NS_ConvertUCS2toUTF8(defaultFileName).get());
+ filename = g_strdup (default_name);
}
+ g_free (default_name);
+
if (askDownloadDest)
{
EphyFileChooser *dialog;