From mboxrd@z Thu Jan 1 00:00:00 1970 From: dato@net.com.org.es (Adeodato =?utf-8?B?U2ltw7M=?=) Date: Thu, 30 Jul 2009 17:56:56 +0200 Subject: [sup-talk] [PATCH] mime-decode hook: provide a "charset" variable with the attachment charset In-Reply-To: <1248713434-sup-4961@entry> References: <6fc2e5dd8aa2b0b8547375d77b1776d779f85817.1247238014.git.dato@net.com.org.es> <20090723093543.GA2265@chistera.yi.org> <1248713434-sup-4961@entry> Message-ID: <20090730155656.GA20442@chistera.yi.org> + William Morgan (Mon, 27 Jul 2009 09:51:17 -0700): > Reformatted excerpts from Adeodato Sim?'s message of 2009-07-23: > > + Adeodato Sim? (Fri, 10 Jul 2009 17:00:29 +0200): > > > + :charset => encoded_content.charset, > > Hm, so apparently encoded_content doesn't always have a charset > > member... > In which case that value of that variable is nil, right? Is that a > problem? The patch still seems useful. Yes, I took a closer look and you're right the result of encoded_content.charset is nil in that case. I also saw (I think) where the traceback I was seeing is coming from: apparently it's not possible to pass to HookContext a local that is nil, since then "super" will get called in HookContext::method_missing() as far as I can see. So, perhaps, to fix this patch, one could do: :charset => encoded_content.charset || '' But then, I think it would be better to fix HookContext to allow for @__locals to contain nil. I'm not very familiar with that class, but it seems easy enough to fix, see upcoming patch (also found in ~dato/sup/sup-dato:fixes at Gitorious, if you prefer that). With it, this improvement to mime-decode seems to work without any further trouble. Cheers, -- - Are you sure we're good? - Always. -- Rory and Lorelai