Skip to content

Commit

Permalink
Make boundary regex configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
Webklex committed Oct 28, 2021
1 parent e22be3e commit 4731293
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) princip
- NaN

### Added
- NaN
- Make boundary regex configurable #108 #152 (thanks @EthraZa)

### Affected Classes
- NaN
Expand Down
3 changes: 2 additions & 1 deletion src/Header.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,8 @@ public function find($pattern) {
* @return string|null
*/
public function getBoundary(){
$boundary = $this->find("/boundary\=(.*)/i");
$regex = isset($this->config["boundary"]) ? $this->config["boundary"] : "/boundary=(.*?(?=;)|(.*))/i";
$boundary = $this->find($regex);

if ($boundary === null) {
return null;
Expand Down
1 change: 1 addition & 0 deletions src/config/imap.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@
'fetch_flags' => true,
'soft_fail' => false,
'rfc822' => true,
'boundary' => '/boundary=(.*?(?=;)|(.*))/i',
'message_key' => 'list',
'fetch_order' => 'asc',
'dispositions' => ['attachment', 'inline'],
Expand Down

0 comments on commit 4731293

Please sign in to comment.