aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2004-03-05 08:29:00 +0800
committerChristian Persch <chpe@src.gnome.org>2004-03-05 08:29:00 +0800
commita6a3257ce715d1e88f656b29def443829af1967d (patch)
tree54012dacc07562ee33b76b2ba9778e22ea85a108
parent4cd87708ec25ca956f690a6b46ac140985973a5f (diff)
downloadgsoc2013-epiphany-a6a3257ce715d1e88f656b29def443829af1967d.tar
gsoc2013-epiphany-a6a3257ce715d1e88f656b29def443829af1967d.tar.gz
gsoc2013-epiphany-a6a3257ce715d1e88f656b29def443829af1967d.tar.bz2
gsoc2013-epiphany-a6a3257ce715d1e88f656b29def443829af1967d.tar.lz
gsoc2013-epiphany-a6a3257ce715d1e88f656b29def443829af1967d.tar.xz
gsoc2013-epiphany-a6a3257ce715d1e88f656b29def443829af1967d.tar.zst
gsoc2013-epiphany-a6a3257ce715d1e88f656b29def443829af1967d.zip
Replace filename validity check, it was making the filename invalid
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.
-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;