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

Update Message.php #20

Closed
wants to merge 1 commit into from
Closed

Conversation

oneFoldSoftware
Copy link

@oneFoldSoftware oneFoldSoftware commented Oct 7, 2020

I See that the suggested Pull is not working at all, sorry for that.

So this is not recognized as attachment:
adsfadf234234sefsdfsd234234 22222 5545498 6542313845.csv

this also not:
adsfadf234234sefsdfsd2342342222255454986542313845.csv

But this is:
adsfadf234234sefsdfsd2342342222255.csv

Looks like a length issue as well? Any ideas?

When having filenames that include spaces, the files are not recognized.

For example:
MyComp B828 - 2922.csv (not recognized)

Same File
MyComp_B828_-_2922.csv (is recognized as attachment)

Altering the getName() function fixed it for me.
@oneFoldSoftware
Copy link
Author

oneFoldSoftware commented Oct 8, 2020

With these two lines added to attachments.php (line 208) it seems to work...

Attachments.php

/**
     * Fetch the given attachment
     */
    protected function fetch() {

        $content = $this->part->content;

        $this->content_type = $this->type.'/'.strtolower($this->part->subtype);
        $this->content = $this->oMessage->decodeString($content, $this->part->encoding);

        if (($id = $this->part->id) !== null) {
            $this->id = str_replace(['<', '>'], '', $id);
        }

        $this->size = $this->part->bytes;

        if (($name = $this->part->name) !== null) {
            $this->setName($name);
            $this->disposition = $this->part->disposition;
        } else if (($filename = $this->part->filename) !== null) {
            $this->setName($filename);
            $this->disposition = $this->part->disposition;
        } else {                                                                       <<<<<<<--------------------------- 227
            $this->setName($this->part->disposition);             <<<<<<<--------------------------- 228 
            $this->disposition = $this->part->disposition;         <<<<<<<--------------------------- 229
        }                                                                                  <<<<<<<--------------------------- 230

        if (IMAP::ATTACHMENT_TYPE_MESSAGE == $this->part->type) {
            if ($this->part->ifdescription) {
                $this->setName($this->part->description);
            } else {
                $this->setName($this->part->subtype);
            }
        }
    }

@oneFoldSoftware oneFoldSoftware deleted the patch-2 branch October 8, 2020 13:11
Webklex added a commit that referenced this pull request Oct 8, 2020
@oneFoldSoftware
Copy link
Author

thanks a lot !

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

Successfully merging this pull request may close these issues.

1 participant