Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 014942ea

Von Tamino Steinert vor 7 Monaten hinzugefügt

  • ID 014942eaaa67edf5c310d70f4c332768a2a338b2
  • Vorgänger 61dca5d3
  • Nachfolger 36f031f5

EmailJournal: zeige nur Standarddateiformate in Dateivorschau

Unterschiede anzeigen:

SL/Controller/EmailJournal.pm
$::form->error(t8('You do not have permission to access this entry.'));
}
my $name = $attachment->name;
my $content = \$attachment->content;
my $mime_type = $attachment->mime_type;
# try to guess the mime_type
if ($mime_type eq 'application/octet-stream') {
# try to guess the mime_type
if ($attachment->content =~ m/^%PDF/) {
$mime_type = 'application/pdf';
} else {
$mime_type = File::MimeInfo::Magic::mimetype($attachment->name);
$mime_type = 'text/plain' if $mime_type eq 'application/octet-stream';
$mime_type ||= 'text/plain';
}
}
# only show standard types
if (!any {$mime_type =~ m/^\Q$_\E/} qw(
text/plain text/xml image/png image/jpeg
application/pdf application/json application/xml
)) {
$content = \t8("Can't display file")->translated;
$name = '';
$mime_type = 'text/plain';
}
return $self->send_file(
\$attachment->content,
name => $attachment->name,
$content,
name => $name,
type => $mime_type,
content_disposition => 'inline',
);

Auch abrufbar als: Unified diff