-# Copyright (C) 2018 all contributors <meta@public-inbox.org>
+# Copyright (C) 2018-2019 all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
+# Unstable internal API.
+# Used for on-the-fly duplicate detection in V2 inboxes.
+# This is not stored in any database anywhere and may change
+# as changes in duplicate detection are needed.
+# See L<public-inbox-v2-format(5)> manpage for more details.
package PublicInbox::ContentId;
use strict;
use warnings;
}
$dig->add("b\0");
my $ct = $part->content_type || 'text/plain';
- my $s = eval { $part->body_str };
- if ($@ && $ct =~ m!\btext/plain\b!i) {
- # Try to assume UTF-8 because Alpine
- # seems to do wacky things and set
- # charset=X-UNKNOWN
- $part->charset_set('UTF-8');
- $s = eval { $part->body_str };
- }
+ my ($s, undef) = msg_part_text($part, $ct);
if (defined $s) {
$s =~ s/\r\n/\n/gs;
$s =~ s/\s*\z//s;