From 580c3f4ffe9608d2beb56d418c68b3b112420e76 Mon Sep 17 00:00:00 2001 From: Mario Date: Sun, 10 Nov 2019 12:49:51 +0000 Subject: another bulk of composer updates (cherry picked from commit 6685381fd8db507493c3d7c1793f8c05c681bbce) --- .../sabre/dav/lib/DAV/Browser/GuessContentType.php | 49 ++++++++++------------ 1 file changed, 22 insertions(+), 27 deletions(-) (limited to 'vendor/sabre/dav/lib/DAV/Browser/GuessContentType.php') diff --git a/vendor/sabre/dav/lib/DAV/Browser/GuessContentType.php b/vendor/sabre/dav/lib/DAV/Browser/GuessContentType.php index 3ba2aee25..7466babb3 100644 --- a/vendor/sabre/dav/lib/DAV/Browser/GuessContentType.php +++ b/vendor/sabre/dav/lib/DAV/Browser/GuessContentType.php @@ -1,14 +1,16 @@ 'image/jpeg', 'gif' => 'image/gif', @@ -44,58 +45,52 @@ class GuessContentType extends DAV\ServerPlugin { // text 'txt' => 'text/plain', - ]; /** - * Initializes the plugin + * Initializes the plugin. * * @param DAV\Server $server - * @return void */ - function initialize(DAV\Server $server) { - + public function initialize(DAV\Server $server) + { // Using a relatively low priority (200) to allow other extensions // to set the content-type first. $server->on('propFind', [$this, 'propFind'], 200); - } /** - * Our PROPFIND handler + * Our PROPFIND handler. * * Here we set a contenttype, if the node didn't already have one. * * @param PropFind $propFind - * @param INode $node - * @return void + * @param INode $node */ - function propFind(PropFind $propFind, INode $node) { - - $propFind->handle('{DAV:}getcontenttype', function() use ($propFind) { + public function propFind(PropFind $propFind, INode $node) + { + $propFind->handle('{DAV:}getcontenttype', function () use ($propFind) { + list(, $fileName) = Uri\split($propFind->getPath()); - list(, $fileName) = URLUtil::splitPath($propFind->getPath()); return $this->getContentType($fileName); - }); - } /** - * Simple method to return the contenttype + * Simple method to return the contenttype. * * @param string $fileName + * * @return string */ - protected function getContentType($fileName) { - + protected function getContentType($fileName) + { // Just grabbing the extension $extension = strtolower(substr($fileName, strrpos($fileName, '.') + 1)); if (isset($this->extensionMap[$extension])) { return $this->extensionMap[$extension]; } - return 'application/octet-stream'; + return 'application/octet-stream'; } - } -- cgit v1.2.3