user/dev discussion of public-inbox itself
 help / color / Atom feed
* [PATCH] emlcontentfoo: drop the {discrete} and {composite} fields
@ 2020-05-10  9:42 Eric Wong
  0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2020-05-10  9:42 UTC (permalink / raw)
  To: meta

We don't have to worry about compatibility with old
installations of Email::MIME::ContentType any longer,
so save some space.
---
 lib/PublicInbox/EmlContentFoo.pm | 10 ----------
 lib/PublicInbox/WwwAttach.pm     |  3 +--
 t/eml_content_type.t             |  4 ----
 3 files changed, 1 insertion(+), 16 deletions(-)

diff --git a/lib/PublicInbox/EmlContentFoo.pm b/lib/PublicInbox/EmlContentFoo.pm
index e6005d290c9..c163eaf5183 100644
--- a/lib/PublicInbox/EmlContentFoo.pm
+++ b/lib/PublicInbox/EmlContentFoo.pm
@@ -102,11 +102,6 @@ sub parse_content_type {
 		type	   => $type,
 		subtype	=> $subtype,
 		attributes => $attributes,
-
-		# This is dumb.  Really really dumb.  For backcompat. -- rjbs,
-		# 2013-08-10
-		discrete   => $type,
-		composite  => $subtype,
 	};
 }
 
@@ -301,11 +296,6 @@ This routine parses email content type headers according to section 5.1 of RFC
 a hash as above, with entries for the C<type>, the C<subtype>, and a hash of
 C<attributes>.
 
-For backward compatibility with a really unfortunate misunderstanding of RFC
-2045 by the early implementors of this module, C<discrete> and C<composite> are
-also present in the returned hashref, with the values of C<type> and C<subtype>
-respectively.
-
 =func parse_content_disposition
 
 This routine is exported by default.
diff --git a/lib/PublicInbox/WwwAttach.pm b/lib/PublicInbox/WwwAttach.pm
index 754da13ffde..7e8496d7ab9 100644
--- a/lib/PublicInbox/WwwAttach.pm
+++ b/lib/PublicInbox/WwwAttach.pm
@@ -17,8 +17,7 @@ sub get_attach_i { # ->each_part callback
 	my $ct = $part->content_type;
 	$ct = parse_content_type($ct) if $ct;
 
-	# discrete == type, we remain Debian wheezy-compatible
-	if ($ct && (($ct->{discrete} || '') eq 'text')) {
+	if ($ct && (($ct->{type} || '') eq 'text')) {
 		# display all text as text/plain:
 		my $cset = $ct->{attributes}->{charset};
 		if ($cset && ($cset =~ /\A[a-zA-Z0-9_\-]+\z/)) {
diff --git a/t/eml_content_type.t b/t/eml_content_type.t
index 5fd7d1d98c4..5acd51ad747 100644
--- a/t/eml_content_type.t
+++ b/t/eml_content_type.t
@@ -260,10 +260,6 @@ my %non_strict_ct_tests = (
 sub test {
 	my ($string, $expect, $info) = @_;
 
-	# So stupid. -- rjbs, 2013-08-10
-	$expect->{discrete}  = $expect->{type};
-	$expect->{composite} = $expect->{subtype};
-
 	local $_;
 	$info =~ s/\r/\\r/g;
 	$info =~ s/\n/\\n/g;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, back to index

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-10  9:42 [PATCH] emlcontentfoo: drop the {discrete} and {composite} fields Eric Wong

user/dev discussion of public-inbox itself

Archives are clonable:
	git clone --mirror http://public-inbox.org/meta
	git clone --mirror http://czquwvybam4bgbro.onion/meta
	git clone --mirror http://hjrcffqmbrq6wope.onion/meta
	git clone --mirror http://ou63pmih66umazou.onion/meta

Example config snippet for mirrors

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.mail.public-inbox.meta
	nntp://ou63pmih66umazou.onion/inbox.comp.mail.public-inbox.meta
	nntp://czquwvybam4bgbro.onion/inbox.comp.mail.public-inbox.meta
	nntp://hjrcffqmbrq6wope.onion/inbox.comp.mail.public-inbox.meta
	nntp://news.gmane.io/gmane.mail.public-inbox.general

 note: .onion URLs require Tor: https://www.torproject.org/

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git