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

mimetype:update-db changes a folder to "audio/*" #27585

Closed
Rello opened this issue Apr 6, 2017 · 8 comments
Closed

mimetype:update-db changes a folder to "audio/*" #27585

Rello opened this issue Apr 6, 2017 · 8 comments

Comments

@Rello
Copy link
Contributor

Rello commented Apr 6, 2017

Steps to reproduce

  1. create a folder "WAV"
  2. check filecache: mimetype 1 (unix directory)
  3. execute occ maintenance:mimetype:update-db --repair-filecache
  4. check filecache: mimetype "audio/wav"

Expected behaviour

nothing bad

Actual behaviour

a folder becomes an audio file

Server configuration

Operating system:
Debian
Web server:
nginx
Database:
mariadb
PHP version:
7.0
ownCloud version: (see ownCloud admin page)
9.1.4

@Rello Rello changed the title mimetype:update-update changes a folder to "audio/*" mimetype:update-db changes a folder to "audio/*" Apr 6, 2017
@PVince81
Copy link
Contributor

PVince81 commented Apr 7, 2017

I guess the mimetype code needs to first verify whether the target is actually a file.

@Rello do you have time to dig into this ?

@Rello
Copy link
Contributor Author

Rello commented Apr 7, 2017

@PVince81 I think I this is the related part

public function updateFilecache($ext, $mimetypeId) {
$update = $this->dbConnection->getQueryBuilder();
$update->update('filecache')
->set('mimetype', $update->createNamedParameter($mimetypeId))
->where($update->expr()->neq(
'mimetype', $update->createNamedParameter($mimetypeId)
))
->andWhere($update->expr()->like(
$update->createFunction('LOWER(`name`)'), $update->createNamedParameter($ext)
));

it does a plain find by like LOWER(name) and there, even a folder /WAV will be changed.
how to approach this?
by excluding folders in general you don´t have the possibility to change the global folder-mime-type anymore. but compared to this issue, this should be neglected.

do you agree?

the simplest solution would be to exclude the mimetype completely from processing
"httpd/unix-directory": "dir",

@PVince81
Copy link
Contributor

PVince81 commented Apr 7, 2017

Excluding the directory mimetype in that query sounds like a good plan.

@Rello
Copy link
Contributor Author

Rello commented Apr 7, 2017

I will create a pull

@PVince81
Copy link
Contributor

PVince81 commented Apr 7, 2017

thanks a lot!

PVince81 pushed a commit that referenced this issue Jul 6, 2017
check if folder is "httpd/unix-directory" and don´t perform here #27585
PVince81 pushed a commit that referenced this issue Jul 6, 2017
check if folder is "httpd/unix-directory" and don´t perform here #27585
DeepDiver1975 pushed a commit that referenced this issue Jul 11, 2017
check if folder is "httpd/unix-directory" and don´t perform here #27585
DeepDiver1975 pushed a commit that referenced this issue Jul 11, 2017
check if folder is "httpd/unix-directory" and don´t perform here #27585
@ownclouders
Copy link
Contributor

Hey, this issue has been closed because the label status/STALE is set and there were no updates for 7 days. Feel free to reopen this issue if you deem it appropriate.

@PVince81
Copy link
Contributor

this was fixed through #27668

@lock
Copy link

lock bot commented Aug 1, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Aug 1, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants