Browse Source

Escape photo download title

Tobias Reich 9 years ago
parent
commit
5d9e41d2ae
1 changed files with 9 additions and 0 deletions
  1. 9 0
      php/modules/Photo.php

+ 9 - 0
php/modules/Photo.php

@@ -588,9 +588,18 @@ class Photo extends Module {
 			return false;
 		}
 
+		# Illicit chars
+		$badChars =	array_merge(
+						array_map('chr', range(0,31)),
+						array("<", ">", ":", '"', "/", "\\", "|", "?", "*")
+					);
+
 		# Parse title
 		if ($photo->title=='') $photo->title = 'Untitled';
 
+		# Escape title
+		$zipTitle = str_replace($badChars, '', $zipTitle);
+
 		# Set headers
 		header("Content-Type: application/octet-stream");
 		header("Content-Disposition: attachment; filename=\"" . $photo->title . $extension . "\"");