Only execute plain mimetype check for directories and do the fallback…#24459
Conversation
… only for non-directories Ref #23096 Signed-off-by: Morris Jobke <hey@morrisjobke.de>
|
/backport to stable20 |
|
/backport to stable19 |
| return $this->executeStringCheck($operator, $value, $actualValue) || | ||
| $this->executeStringCheck($operator, $value, $this->mimeTypeDetector->detectPath($this->path)); | ||
| $plainMimetypeResult = $this->executeStringCheck($operator, $value, $actualValue); | ||
| if ($actualValue === 'httpd/unix-directory') { |
There was a problem hiding this comment.
without looking deeper into detectPath method, it should be OK to or this against $plainMimetypeResult since it is returned anyway if true. Unless detectPath must run for a reason?
There was a problem hiding this comment.
This then would always lead to the check to be true.
Check for !is MIMETYPE means that either httpd/unix-directory or application/octet-stream does not match and therefore the check is useless, because it can't check for both.
There was a problem hiding this comment.
To make it short: detectPath never returns the folder mimetype, because it uses the extension to determine the mime type and if there is none, it returns application/octet-stream.
rullzer
left a comment
There was a problem hiding this comment.
Looks sane but I didn't test.
… only for non-directories
Introduced with #23096
Fixes nextcloud/files_accesscontrol#182
@juliushaertl I'm open for other approaches, but this seems to be useful here.