Merge pull request #10829 from nextcloud/backport/10828/mimetype-detection-broken-for-junked-uploads

[stable13] Fix mimetype detection for junked uploads
This commit is contained in:
blizzz 2018-09-13 10:51:06 +02:00 committed by GitHub
commit 9c68ce1556
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 4 deletions

View File

@ -83,9 +83,13 @@ class FileMimeType extends AbstractStringCheck {
return $this->mimeType[$this->storage->getId()][$this->path];
}
if ($this->request->getMethod() === 'PUT') {
$path = $this->request->getPathInfo();
$this->mimeType[$this->storage->getId()][$this->path] = $this->mimeTypeDetector->detectPath($path);
if ($this->request->getMethod() === 'PUT' || $this->request->getMethod() === 'MOVE') {
if ($this->request->getMethod() === 'MOVE') {
$this->mimeType[$this->storage->getId()][$this->path] = $this->mimeTypeDetector->detectPath($this->path);
} else {
$path = $this->request->getPathInfo();
$this->mimeType[$this->storage->getId()][$this->path] = $this->mimeTypeDetector->detectPath($path);
}
return $this->mimeType[$this->storage->getId()][$this->path];
}
} else if ($this->isPublicWebDAVRequest()) {
@ -171,7 +175,9 @@ class FileMimeType extends AbstractStringCheck {
$this->request->getPathInfo() === '/webdav' ||
strpos($this->request->getPathInfo(), '/webdav/') === 0 ||
$this->request->getPathInfo() === '/dav/files' ||
strpos($this->request->getPathInfo(), '/dav/files/') === 0
strpos($this->request->getPathInfo(), '/dav/files/') === 0 ||
$this->request->getPathInfo() === '/dav/uploads' ||
strpos($this->request->getPathInfo(), '/dav/uploads/') === 0
);
}