Webklex / laravel-imap

Laravel IMAP is an easy way to integrate both the native php-imap module and an extended custom imap protocol into your Laravel app.
https://www.php-imap.com
MIT License
631 stars 178 forks source link

Encoding error on folder names #271

Closed DBA-HH closed 4 years ago

DBA-HH commented 4 years ago

I had a folder name containing the danish o (ø). Method getFolders of laravel-imap v1.4.4 threw an exception because $items = imap_getmailboxes($this->connection, $this->getAddress(), $pattern); (in Client.php:363) did not find anything and returned null.

Adjusting the following lines solved the problem (but surely is not the best solution)

Folder.php:123

    public function __construct(Client $client, $structure) {
        // ...
        $this->full_name  = $this->decodeName($structure->name);
        $this->full_name_original  = $structure->name;
        // ...
    }

Client.php:369

    public function getFolders($hierarchical = true, $parent_folder = null) {
        // ...
                if ($hierarchical && $folder->hasChildren()) {
                  //$pattern = $folder->full_name.$folder->delimiter.'%';
                    $pattern = $folder->full_name_original.$folder->delimiter.'%';
                    // ...
                }
        // ...
    }

Not sure if this is relevant, but the folder with the danish o did contain nothing but a single subfolder, which contains nothing but a single mail.

Webklex commented 4 years ago

Hi @DBA-HH , this issue should be solved with the latest update. Thanks for your patience :)

Best regards,