From: Bharat M. <bh...@us...> - 2004-02-27 08:43:56
|
Update of /cvsroot/gallery/gallery2/modules/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27212/modules/core Modified Files: ItemAddChildren.inc Log Message: Fixed uploading files from local server and web page that have special characters in them (like apostrophes). Bug #904045. Index: ItemAddChildren.inc =================================================================== RCS file: /cvsroot/gallery/gallery2/modules/core/ItemAddChildren.inc,v retrieving revision 1.42 retrieving revision 1.43 diff -w -u -r1.42 -r1.43 --- ItemAddChildren.inc 16 Feb 2004 07:21:42 -0000 1.42 +++ ItemAddChildren.inc 27 Feb 2004 08:35:21 -0000 1.43 @@ -120,7 +120,17 @@ foreach ($form['localServerFiles'] as $fileKey => $unused) { $filename = $fileKey; - $filepath = $dir . '/' . $filename; + + // Build up the file path with the right style of directory separator + $slash = $platform->getDirectorySeparator(); + $filepath = $dir; + if ($filepath[strlen($filepath)-1] != $slash) { + $filepath .= $slash; + } + $filepath .= $filename; + + // Unescape any special chars in the file path + $filepath = GalleryUtilities::htmlEntityDecode($filepath); list ($base, $extension) = GalleryUtilities::getFileNameComponents($filename); $mimeType = GalleryUtilities::convertExtensionToMime($extension); @@ -152,6 +162,7 @@ $tmpFile = $platform->tempnam($tmpDir, 'add'); $successfullyCopied = false; + $url = GalleryUtilities::htmlEntityDecode($url); $fin = $platform->fopen($url, 'rb'); if ($fin) { $fout = $platform->fopen($tmpFile, 'wb'); |