diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2004-03-05 08:29:00 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2004-03-05 08:29:00 +0800 |
commit | a6a3257ce715d1e88f656b29def443829af1967d (patch) | |
tree | 54012dacc07562ee33b76b2ba9778e22ea85a108 /embed/mozilla | |
parent | 4cd87708ec25ca956f690a6b46ac140985973a5f (diff) | |
download | gsoc2013-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.
Diffstat (limited to 'embed/mozilla')
-rw-r--r-- | embed/mozilla/EphyHeaderSniffer.cpp | 17 |
1 files changed, 7 insertions, 10 deletions
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; |