Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 9e3670e

Browse filesBrowse files
freiondrejfabpot
authored andcommitted
Check whether path is file in DataPart::fromPath()
1 parent a9ffbf4 commit 9e3670e
Copy full SHA for 9e3670e

File tree

1 file changed

+4
-0
lines changed
Filter options

1 file changed

+4
-0
lines changed

‎src/Symfony/Component/Mime/Part/DataPart.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Mime/Part/DataPart.php
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ public static function fromPath(string $path, string $name = null, string $conte
5656
$contentType = self::$mimeTypes->getMimeTypes($ext)[0] ?? 'application/octet-stream';
5757
}
5858

59+
if (false === is_readable($path)) {
60+
throw new InvalidArgumentException(sprintf('Path "%s" is not readable.', $path));
61+
}
62+
5963
if (false === $handle = @fopen($path, 'r', false)) {
6064
throw new InvalidArgumentException(sprintf('Unable to open path "%s".', $path));
6165
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.