[Xfce4-commits] <postler:master> Handle quotes, tabs and extra spaces in content type values
Christian Dywan
noreply at xfce.org
Thu Jul 29 12:26:04 CEST 2010
Updating branch refs/heads/master
to 71de830c8643dea06f078b1738fc2ffc48f00310 (commit)
from 459b807035f31ada628516d90e361a49174a57fc (commit)
commit 71de830c8643dea06f078b1738fc2ffc48f00310
Author: Christian Dywan <christian at twotoasts.de>
Date: Mon Jul 19 23:03:32 2010 +0200
Handle quotes, tabs and extra spaces in content type values
postler/postler-content.vala | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/postler/postler-content.vala b/postler/postler-content.vala
index 172daa0..e82cdc9 100644
--- a/postler/postler-content.vala
+++ b/postler/postler-content.vala
@@ -372,21 +372,21 @@ public class Postler.Content : WebKit.WebView {
if (content_type == null)
return;
- string[] parts = content_type.split_set ("; ");
+ string[] parts = content_type.replace (" = ", "=").split_set ("; \t");
string filename = null;
foreach (var part in parts) {
+
if (part.has_prefix ("charset="))
- charset = part.substring (8, part.length - 8);
+ charset = part.substring (8, part.length - 8).replace ("\"", "");
else if (part.has_prefix ("name="))
- filename = part.substring (5, part.length - 5);
+ filename = part.substring (5, part.length - 5).replace ("\"", "");
else if (part.has_prefix ("boundary="))
- boundary = part.substring (9, part.length - 9);
+ boundary = part.substring (9, part.length - 9).replace ("\"", "");
else if (part != "" && !part.contains ("="))
mime_type = ascii_strdown (part);
}
if (mime_type == "application/octet-stream" && filename != null) {
- filename = filename.replace ("\"", " ").strip ();
uchar[] data = {};
bool uncertain;
mime_type = g_content_type_guess (filename, data, out uncertain);
More information about the Xfce4-commits
mailing list