Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spotty decoding of BASE64 parts #32

Open
sertys3 opened this issue Mar 2, 2024 · 0 comments
Open

Spotty decoding of BASE64 parts #32

sertys3 opened this issue Mar 2, 2024 · 0 comments

Comments

@sertys3
Copy link

sertys3 commented Mar 2, 2024

Greetings,
thank you for the wonderful work thus far. I am running mail2deck for my NextCloud users successfully but since we're based in Eastern Europe, users send mail in cyrillic script which creates a confusion upon card creation. I am not so great at creating PRs and will describe the issue and fix in here. When sending via gmail, the body parts get base64 encoded upon detection of non-latin characters. This does reflect in the imap structure though. I have made small modification to index.php in the message processing as such :
Instead of

$base64encode = false;
if($structure->encoding == 3) {
    $base64encode = true; // BASE64
}

I have modified it to:

$base64encode = false;
if($structure->parts[0]->encoding == 3) {
    $base64encode = true; // BASE64
}
if(isset($structure->parts[0]->parts[0]->encoding) && $structure->parts[0]->parts[0]->encoding == 3){
   // this handles parts with inline attachments
    $base64encode = true; // BASE64
}

This correctly sets the $base64encode flag for the description and decodes the body characters correctly.
I hope you find the time to implement such a change for the non-latin users in the community.

Kindest regards,
Daniel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant