Browse Source

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
mark_story 12 years ago
parent
commit
7b2ac816c6
1 changed files with 2 additions and 3 deletions
  1. 2 3
      lib/Cake/Network/Email/CakeEmail.php

+ 2 - 3
lib/Cake/Network/Email/CakeEmail.php

@@ -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']);