]> source.dussan.org Git - nextcloud-server.git/commitdiff
Don't set Content-Length header if size is unknown
authorMichael Gapczynski <mtgap@owncloud.com>
Fri, 17 May 2013 18:14:12 +0000 (14:14 -0400)
committerMichael Gapczynski <mtgap@owncloud.com>
Fri, 17 May 2013 18:14:12 +0000 (14:14 -0400)
lib/files.php

index ab7fa1ed096ef21ec0d0b8413de8e16cd6920eae..abb1617c25ee85709a618e79fdaab0971da3e411 100644 (file)
@@ -123,8 +123,11 @@ class OC_Files {
                                header('Content-Length: ' . filesize($filename));
                                self::addSendfileHeader($filename);
                        }else{
+                               $filesize = \OC\Files\Filesystem::filesize($filename);
                                header('Content-Type: '.\OC\Files\Filesystem::getMimeType($filename));
-                               header("Content-Length: ".\OC\Files\Filesystem::filesize($filename));
+                               if ($filesize > -1) {
+                                       header("Content-Length: ".$filesize);
+                               }
                                list($storage) = \OC\Files\Filesystem::resolvePath($filename);
                                if ($storage instanceof \OC\Files\Storage\Local) {
                                        self::addSendfileHeader(\OC\Files\Filesystem::getLocalFile($filename));