diff --git a/lib/helper.php b/lib/helper.php
index 7a36a8182d5b9e88b16b7c5e987451cacc2fd848..3de7b3fdc107f7192770d525f44cd9f951309188 100644
--- a/lib/helper.php
+++ b/lib/helper.php
@@ -376,7 +376,7 @@ class OC_Helper {
 			pclose($fp);
 
 			//trim the character set from the end of the response
-			$mimeType=substr($reply,0,strrpos($reply,';'));
+			$mimeType=substr($reply,0,strrpos($reply,' '));
 		}
 		if ($mimeType=='application/octet-stream') {
 			// Fallback solution: (try to guess the type by the file extension