Skip to content

Move mimetypes.list.php to config/mimetypemapping.dist.json - #17481

Merged
MorrisJobke merged 3 commits into
owncloud:masterfrom
rullzer:mimetype-list
Jul 13, 2015
Merged

MorrisJobke merged 3 commits into
owncloud:masterfrom
rullzer:mimetype-list

Conversation

@rullzer

@rullzer rullzer commented Jul 8, 2015

Copy link
Copy Markdown
Contributor

This allows users to add new mimetypemappings (extention -> mimetype)
themself. And not have to wait until a new release for updated
mimetypes.

Fixes: #15384

CC: @oparoz @Xenopathic @MorrisJobke @PVince81 @DeepDiver1975

This allows users to add new mimetypemappings (extention -> mimetype)
themself. And not have to wait until a new release for updated
mimetypes.

Fixes: #15384
@rullzer rullzer added this to the 8.2-current milestone Jul 8, 2015
@rullzer

rullzer commented Jul 8, 2015

Copy link
Copy Markdown
Contributor Author

mmmm, we actually should make sure that this file does not get overwritten during an upgrade... else the user loses his additions...
Same actually holds for config/mimetypealiases.json

@oparoz

oparoz commented Jul 8, 2015

Copy link
Copy Markdown
Contributor

Isn't the config folder left untouched?

I don't remember the instructions. If admins have to move the config, they can also move those json files.

@RobinMcCorkell

Copy link
Copy Markdown
Contributor

Perhaps we should support loading multiple files, e.g. mimetypemapping.custom.json, which is packaged as empty and never gets overridden by updates. Any entries in that file override the ones in mimetypemapping.json, which has a note at the top explicitly telling admins not to put stuff there.

Or do it the other way around - make the custom one mimetypemapping.json, with a mimetypemapping.dist.json for the distributed packaged one.

Likewise for the other mimetype file of course.

@RobinMcCorkell

Copy link
Copy Markdown
Contributor

But otherwise this PR looks good 👍

@oparoz

oparoz commented Jul 8, 2015

Copy link
Copy Markdown
Contributor

Good call @Xenopathic. Makes it clear what is what.

@RobinMcCorkell

Copy link
Copy Markdown
Contributor

Interesting side note, oC actually loads any config files with the name *.config.php (https://github.com/owncloud/core/blob/master/lib/private/config.php#L183). Not particularly useful for configs, but very handy in this case where we need a default packaged file that gets updated.

@rullzer

rullzer commented Jul 8, 2015

Copy link
Copy Markdown
Contributor Author

Agreed lets use mimetypemapping.dist.json... let me fix that for this PR. And create a new one for the mimetypealiases.json

@rullzer

rullzer commented Jul 8, 2015

Copy link
Copy Markdown
Contributor Author

Done :)

@rullzer rullzer changed the title Move mimetypes.list.php to config/mimetypemapping.json Move mimetypes.list.php to config/mimetypemapping.dist.json Jul 8, 2015
Comment thread config/mimetypemapping.dist.json Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This needs to be phrased like a warning:

Any changes you make here will be overwritten on an update of ownCloud
Put any custom mappings in a new file mimetypemapping.json in this directory

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done :)

This allows users to create their own mapping file to extend our current
mappings. This makes sure that custom mappings are not lost on OC
upgrades.
@RobinMcCorkell

Copy link
Copy Markdown
Contributor

Nice! 👍

We need some documentation for this though. And do we want to ship a blank mimetypemapping.json with only comments saying how to use the file? Or do we want to require the user to manually create the file, and be expected to know the syntax etc?

@oparoz

oparoz commented Jul 8, 2015

Copy link
Copy Markdown
Contributor

@Xenopathic I'd say it's an advanced feature and it shouldn't be too much to ask of an admin to create the file.

@rullzer

rullzer commented Jul 10, 2015

Copy link
Copy Markdown
Contributor Author

Added todo issue for the docs.

One more review guys :)

Comment thread lib/private/helper.php Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@rullzer Can you change this to \OC::$configDir?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ah didn't know about that one. Fixed!

@scrutinizer-notifier

Copy link
Copy Markdown

A new inspection was created.

Comment thread lib/private/helper.php

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actually, TBH I think the code looks better with those slashes there. PHP ignores multiple slashes (as does any UNIX utility), so we have no bug concerns, and it also means less effort if $configDir at some point loses the trailing slash.

TL;DR: leave the slashes, they're good 😄

@RobinMcCorkell

Copy link
Copy Markdown
Contributor

👍

@ghost

ghost commented Jul 10, 2015

Copy link
Copy Markdown

🚀 Test PASSed.🚀
chuck

@MorrisJobke

Copy link
Copy Markdown
Contributor

Mime type detection still works 👍

MorrisJobke added a commit that referenced this pull request Jul 13, 2015
Move mimetypes.list.php to config/mimetypemapping.dist.json
@MorrisJobke
MorrisJobke merged commit 1006ec5 into owncloud:master Jul 13, 2015
@rullzer
rullzer deleted the mimetype-list branch July 13, 2015 06:31
@lock lock Bot locked as resolved and limited conversation to collaborators Aug 11, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Move mimetypes.list.php to a text file in /config

5 participants