Retain the original file name so errors can be generated properly.

We should hold onto the original file so we can generate a error message
when the file is not found.

Fixes #2990
Closes #3011
This commit is contained in:
mark_story 2014-03-13 12:29:16 -04:00
parent fda242f000
commit 7b2ac816c6

View file

@ -1,7 +1,5 @@
<?php
/**
* CakePHP Email
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
@ -1022,9 +1020,10 @@ class CakeEmail {
}
$fileInfo['data'] = chunk_split(base64_encode($fileInfo['data']), 76, "\r\n");
} else {
$fileName = $fileInfo['file'];
$fileInfo['file'] = realpath($fileInfo['file']);
if ($fileInfo['file'] === false || !file_exists($fileInfo['file'])) {
throw new SocketException(__d('cake_dev', 'File not found: "%s"', $fileInfo['file']));
throw new SocketException(__d('cake_dev', 'File not found: "%s"', $fileName));
}
if (is_int($name)) {
$name = basename($fileInfo['file']);