Skip to content

Get correct mimetype on objectstores - #19888

Merged
rullzer merged 1 commit into
masterfrom
fix/objectstore_rename_mimetype
Mar 12, 2020
Merged

Get correct mimetype on objectstores#19888
rullzer merged 1 commit into
masterfrom
fix/objectstore_rename_mimetype

Conversation

@rullzer

Copy link
Copy Markdown
Member

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

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
@rullzerrullzer added bug 2. developing Work in progress labels Mar 11, 2020
@rullzerrullzer added this to the Nextcloud 19 milestone Mar 11, 2020
@rullzerrullzer added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Mar 12, 2020

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

Copy link
Copy Markdown
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 {
returnfalse;
}

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
Copy Markdown
MemberAuthor

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
Copy Markdown
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 masterMar 12, 2020
@rullzer
rullzer deleted the fix/objectstore_rename_mimetype branch March 12, 2020 18:58
@rullzer

Copy link
Copy Markdown
MemberAuthor

/backport to stable18

@rullzer

Copy link
Copy Markdown
MemberAuthor

/backport to stable17

@backportbot-nextcloud

Copy link
Copy Markdown

backport to stable18 in #19916

@backportbot-nextcloud

Copy link
Copy Markdown

backport to stable17 in #19917

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to reviewWaiting for reviewsbug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@rullzer@nickvergessen@icewind1991@juliusknorr