Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only execute plain mimetype check for directories and do the fallback… #24459

Merged

Conversation

MorrisJobke
Copy link
Member

… 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.

… only for non-directories

Ref #23096

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
@MorrisJobke
Copy link
Member Author

/backport to stable20

@MorrisJobke
Copy link
Member Author

/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') {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Member

@rullzer rullzer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks sane but I didn't test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rule "File Mime-Typ is not Folder" not work anymore
4 participants