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

Get correct mimetype on objectstores #19888

Merged
merged 1 commit into from Mar 12, 2020
Merged

Conversation

rullzer
Copy link
Member

@rullzer rullzer commented Mar 11, 2020

Signed-off-by: Roeland Jago Douma roeland@famdouma.nl

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
@rullzer rullzer added bug 2. developing Work in progress labels Mar 11, 2020
@rullzer rullzer added this to the Nextcloud 19 milestone Mar 11, 2020
@rullzer rullzer added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Mar 12, 2020
@@ -349,12 +349,7 @@ public function rename($source, $target) {

public function getMimeType($path) {
$path = $this->normalizePath($path);
$stat = $this->stat($path);
Copy link
Member

Choose a reason for hiding this comment

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

Am I missing something or is in that case mime type detection only done by file extension?

if ($this->is_dir($path)) {
return 'httpd/unix-directory';
} elseif ($this->file_exists($path)) {
return \OC::$server->getMimeTypeDetector()->detectPath($path);
} else {
return false;
}

Same for the Local storage actually

class Local extends \OC\Files\Storage\Common {
Shouldn't that at least use the result from stat?

Copy link
Member Author

Choose a reason for hiding this comment

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

For local it makes sense. For objectstore we have nothing better.
In anycase I woud do this for now. And create an issue for the rest.

Copy link
Member

Choose a reason for hiding this comment

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

OK, thanks, yes I already thought that this would be all we have for object storage.

@rullzer rullzer merged commit b5902b3 into master Mar 12, 2020
@rullzer rullzer deleted the fix/objectstore_rename_mimetype branch March 12, 2020 18:58
@rullzer
Copy link
Member Author

rullzer commented Mar 12, 2020

/backport to stable18

@rullzer
Copy link
Member Author

rullzer commented Mar 12, 2020

/backport to stable17

@backportbot-nextcloud
Copy link

backport to stable18 in #19916

@backportbot-nextcloud
Copy link

backport to stable17 in #19917

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants