Skip to content

Commit

Permalink
Fix for encoding long content-disposition filenames
Browse files Browse the repository at this point in the history
  • Loading branch information
Synchro committed Aug 31, 2014
1 parent 730cf0c commit 76bc29a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions class.phpmailer.php
Expand Up @@ -2180,18 +2180,19 @@ protected function attachAll($disposition_type, $boundary)
// Fixes a warning in IETF's msglint MIME checker
// Allow for bypassing the Content-Disposition header totally
if (!(empty($disposition))) {
if (preg_match('/[ \(\)<>@,;:\\"\/\[\]\?=]/', $name)) {
$encoded_name = $this->encodeHeader($this->secureHeader($name));
if (preg_match('/[ \(\)<>@,;:\\"\/\[\]\?=]/', $encoded_name)) {
$mime[] = sprintf(
'Content-Disposition: %s; filename="%s"%s',
$disposition,
$this->encodeHeader($this->secureHeader($name)),
$encoded_name,
$this->LE . $this->LE
);
} else {
$mime[] = sprintf(
'Content-Disposition: %s; filename=%s%s',
$disposition,
$this->encodeHeader($this->secureHeader($name)),
$encoded_name,
$this->LE . $this->LE
);
}
Expand Down

0 comments on commit 76bc29a

Please sign in to comment.