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

Fix slash in attachment file name issue #676

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gitstashgithub
Copy link

Some systems allow slash(/) in attachment file name, and it causes issue in IncomingMailAttachment::saveToDisk() function. The \file_put_contents() function cannot handle it and throws error
Failed to open stream: No such file or directory

Some systems allow slash(/) in attachment file name, and it causes issue in IncomingMailAttachment::saveToDisk() function. The \file_put_contents() function cannot handle it and throws error
Failed to open stream: No such file or directory
@@ -1348,6 +1348,7 @@ public function downloadAttachment(DataPartInfo $dataInfo, array $params, object
$fileName = $this->decodeMimeStr($fileName);
$fileName = $this->decodeRFC2231($fileName);
}
$fileName = str_replace('/', ' ', $fileName);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would feel better, if we would use a underscore instead of a whitespace as whitespaces can also result in unexpected behaviours.

Suggested change
$fileName = str_replace('/', ' ', $fileName);
$fileName = str_replace('/', '_', $fileName);

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.

2 participants