changeset 11238:04fd99debeb9

[gaim-migrate @ 13389] Fix a potential crash with some versions of gtk on some systems when someone sends you a file with a name with non-good characters committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Fri, 12 Aug 2005 01:12:15 +0000
parents 237d65590d2b
children 657aa9a3a7b0
files src/protocols/oscar/oscar.c
diffstat 1 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/oscar/oscar.c	Fri Aug 12 01:08:32 2005 +0000
+++ b/src/protocols/oscar/oscar.c	Fri Aug 12 01:12:15 2005 +0000
@@ -3617,7 +3617,18 @@
 			xfer = gaim_xfer_new(gc->account, GAIM_XFER_RECEIVE, userinfo->sn);
 			xfer->remote_ip = g_strdup(args->verifiedip);
 			xfer->remote_port = args->port;
-			gaim_xfer_set_filename(xfer, args->info.sendfile.filename);
+
+			if (g_utf8_validate(args->info.sendfile.filename, -1,
+						NULL)) {
+				gaim_xfer_set_filename(xfer,
+						args->info.sendfile.filename);
+			} else {
+				gchar * utf8_filename = gaim_utf8_salvage(
+						args->info.sendfile.filename);
+				gaim_xfer_set_filename(xfer, utf8_filename);
+				g_free(utf8_filename);
+			}
+
 			gaim_xfer_set_size(xfer, args->info.sendfile.totsize);
 			
 			/* Ignore <ICQ_COOL_FT> XML that is sent along with ICQ sendfile requests */