So you can use
Code: Select all
$Attachment->{Content} = decode_base64($Attachment->{Content});
Here is my workaround, with comments
Please tell me if you have suggestions, this workaround work perfect for me
[edit Article.pm file with this lines, make backup before :p ]
Code: Select all
# add attachments
# Change :
# Detect if the attachment is 64 bits encoded, (attachment with PHP)
# if true, decoding else, do nothing
# WARNING : need to change $eol to "" in PHP side, like this :
# Eg : chunk_split(base64_encode(file_get_contents($tmp_file)), 76, "")
if ( $Param{Attachment} ) {
use MIME::Base64;
for my $Attachment ( @{ $Param{Attachment} } ) {
if($Attachment->{Content} =~
m{
^
(?: [A-Za-z0-9+/]{4} )*
(?:
[A-Za-z0-9+/]{2} [AEIMQUYcgkosw048] =
|
[A-Za-z0-9+/] [AQgw] ==
)?
\z
}x
){
$Self->{LogObject}->Log( Priority => 'notice', Message => "64 bits encoded attachment, decoding base 64 (file $Attachment->{Filename})");
$Attachment->{Content} = decode_base64($Attachment->{Content});
}
else{
$Self->{LogObject}->Log( Priority => 'notice', Message => "No 64 bits encoded attachment, nothing to do (file $Attachment->{Filename})");
}
}
for my $Attachment ( @{ $Param{Attachment} } ) {
$Self->ArticleWriteAttachment(
%{$Attachment},
ArticleID => $ArticleID,
UserID => $Param{UserID},
);
}
}
Sory for my poor English