Skip to content

Introduce a few new mimetypes for code, fix recursive mimetype aliases - #19272

Merged
DeepDiver1975 merged 4 commits into
masterfrom
mimetypes-enhanced
Oct 2, 2015
Merged

DeepDiver1975 merged 4 commits into
masterfrom
mimetypes-enhanced

Conversation

@RobinMcCorkell

Copy link
Copy Markdown
Contributor

Some new/fixed mappings (and corresponding aliases):

  • Java .class
  • C++ source .c++
  • C++ header .hpp
  • Java source .java
  • RTF .rtf

In addition, recursive mimetype aliases for getting a filetype icon are implemented, which fixes the icon for XML. application/xml -> text/html -> text/code.

cc @jancborchardt @rullzer @SergioBertolinSG

Fixes #19254

@RobinMcCorkell RobinMcCorkell added this to the 8.2-current milestone Sep 22, 2015
@karlitschek

Copy link
Copy Markdown
Contributor

I would like to question why we need this mime-types in the first place. It we don't show special icons in the web ui then this shoudn't matter.
Or do I miss something?
👎

@RobinMcCorkell

Copy link
Copy Markdown
Contributor Author

@karlitschek At the moment, some files that are code files (e.g. .cpp, .hpp, .java, .xml) are shown as plain text. With this, they get the proper code icon

Comment thread core/js/mimetypelist.js 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.

We do not have »font« anymore. Please use »image« instead.

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.

Above as well.

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.

I didn't touch this file manually, that was update-js doing that. I wonder what the real issue is...

@jancborchardt

Copy link
Copy Markdown
Contributor

@Xenopathic in the PR for the new mimetype icons I directly edited core/js/mimetypelist.js #18608 – it seems some of the changes are overwritten by this. For example we don’t differentiate that much anymore (no specific icons for database, vector, font etc) Can you make sure to move the changes into the source file so it’s fixed? Thanks!

@RobinMcCorkell

Copy link
Copy Markdown
Contributor Author

@jancborchardt Ahh, so your changes were made directly to the JS file instead of the source JSON files?

@RobinMcCorkell

Copy link
Copy Markdown
Contributor Author

@jancborchardt Changes made :)

@jancborchardt

Copy link
Copy Markdown
Contributor

@jancborchardt Ahh, so your changes were made directly to the JS file instead of the source JSON files?

@Xenopathic yes, I am an idiot and didn’t know we have that new source JSON file. ;)

@jancborchardt

Copy link
Copy Markdown
Contributor

Looks good 👍

@SergioBertolinSG please check if this fixes your issue.

@karlitschek

Copy link
Copy Markdown
Contributor

ok. It makes sense to show the code icon. 👍

@SergioBertolinSG

Copy link
Copy Markdown
Contributor

I'm not seeing much improvement here.

.class are not text, so it can stay with the undefined icon.
.java and .rtf are now plain text which is not fine, .java is code and .rtf is document (not sure if the documents app can open it, but it should have same icon as .doc).
👎

.hpp and .c++ are correct.

Many filetypes pending.

@rullzer

rullzer commented Sep 22, 2015

Copy link
Copy Markdown
Contributor

Updated the c++ and cpp mimetypes. They now both map to code.
.class now maps to application/java-vm which maps to the application icon. (I stole that from http://www.freeformatter.com/mime-types-list.html)

@SergioBertolinSG you should run ./occ maintenance:mimetype:update-db to make sure your database is also has all the updated mimetypes.

@Xenopathic feel free to squash our commits.

@RobinMcCorkell

Copy link
Copy Markdown
Contributor Author

@SergioBertolinSG I agree, .class aren't text, which is why they appear with the binary icon? .java is definitely a code type, not plain text. And I was asked to make .rtf text...

@rullzer Please note that text/x-c++src is not a valid mimetype as far as I can tell, there are a few references to it on the Internet but most places say to use text/x-c, as does the file utility. As for .class, the majority of sources used application/java, not application/java-vm. In fact, I could only find one source that said that: http://www.freeformatter.com/mime-types-list.html

@SergioBertolinSG

Copy link
Copy Markdown
Contributor

@rullzer thanks, now I can see fine also .xml, .java and .cpp.

It ok for me to merge this 👍 but there are still lots pending. (some pretty popular like .cs or .rb)

Also rtf as text.

For me it doesn't fix the issue totally, but partially, yes.

@rullzer

rullzer commented Sep 22, 2015

Copy link
Copy Markdown
Contributor

@Xenopathic ah ok fine by me. I just saw the discrepency between c++ and cpp. I'm fine either way.

Regarding .class I also don't really care. Was just my first hit on google :P

@RobinMcCorkell

Copy link
Copy Markdown
Contributor Author

@rullzer RE cpp: oops, I was meant to change both of them then. Still, as long as the icons work properly

@RobinMcCorkell

Copy link
Copy Markdown
Contributor Author

@SergioBertolinSG PRs welcome 😄

@rullzer

rullzer commented Sep 23, 2015

Copy link
Copy Markdown
Contributor

@Xenopathic you are right. cpp and c++ now both map to text/x-c and class maps to application/java.

Rebased since #18893 was merged.

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.

cpp is c plus plus - why is this changed

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.

The generally accepted mimetype for c++ files is text/x-c

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.

warg depending on the source you check it is text/x-c++src
and even text/x-csrc for c files...

@rullzer

rullzer commented Sep 23, 2015

Copy link
Copy Markdown
Contributor

Ok... so which list of mimetypes do we actually follow?

@RobinMcCorkell

Copy link
Copy Markdown
Contributor Author

@rullzer In case there's conflicts between sources on the web, I look at what file -i prints (which is why I chose text/x-c over text/x-c++src)

@RobinMcCorkell

Copy link
Copy Markdown
Contributor Author

Also, being radical for a moment: could ownCloud directly use /usr/share/mime?

@rullzer

rullzer commented Sep 25, 2015

Copy link
Copy Markdown
Contributor

@Xenopathic no. because it is not quaranteed to exist. So probabaly file -i retrieves it mimetypes from somewhere else. Basically /usr/share/mime is part of the freedesktop stuff.

But we could maybe write a script that just parses the stuff from https://wiki.freedesktop.org/www/Software/shared-mime-info/ and creates the proper mappings.

@rullzer

rullzer commented Sep 25, 2015

Copy link
Copy Markdown
Contributor

Anyway. Back on topic. c++ and cpp now map to text/x-c++src again.

@RobinMcCorkell

Copy link
Copy Markdown
Contributor Author

@jancborchardt @SergioBertolinSG Is this complete enough for merge? I know it doesn't cover the full list of mimetypes, but it covers the important ones.

@rullzer
rullzer force-pushed the mimetypes-enhanced branch from 0d730d4 to 03dbc84 Compare October 2, 2015 11:00
@rullzer

rullzer commented Oct 2, 2015

Copy link
Copy Markdown
Contributor

Rebases to make sure there are no conflicts.
Lets get this in. If more mappings are needed eventually we can add those later.

Easy to review!

CC: @PVince81 @MorrisJobke @nickvergessen

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.

I think we need repair steps for the added extensions. Add it with a version number check in https://github.com/owncloud/core/blob/83db69b45d3ff5f49634839c0deafde91872a6b5/lib/repair/repairmimetypes.php#L264-264

But please raise the version number and check for everything that is smaller than the new one.

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.

You are right. Will fix.

Robin McCorkell and others added 3 commits October 2, 2015 15:28
application/xml -> text/html -> text/code
* c++ and cpp now both map to code
@rullzer
rullzer force-pushed the mimetypes-enhanced branch from 03dbc84 to 5262614 Compare October 2, 2015 13:28
@rullzer

rullzer commented Oct 2, 2015

Copy link
Copy Markdown
Contributor

@MorrisJobke added.

* Version number increased
@rullzer
rullzer force-pushed the mimetypes-enhanced branch from 5262614 to c80dd82 Compare October 2, 2015 14:07
@MorrisJobke

Copy link
Copy Markdown
Contributor

Tested and works 👍

@MorrisJobke

Copy link
Copy Markdown
Contributor

@SergioBertolinSG Please review :)

@icewind1991

Copy link
Copy Markdown
Contributor

👍

DeepDiver1975 added a commit that referenced this pull request Oct 2, 2015
Introduce a few new mimetypes for code, fix recursive mimetype aliases
@DeepDiver1975
DeepDiver1975 merged commit ff89824 into master Oct 2, 2015
@DeepDiver1975
DeepDiver1975 deleted the mimetypes-enhanced branch October 2, 2015 15:50
@SergioBertolinSG

Copy link
Copy Markdown
Contributor

Well I only see .java, .xml and .cpp files correct. Tex files has a text icon but cannot be opened. Many more remaining (.cs, .sql, .go...). I'll open a new issue to track the pending ones.

@SergioBertolinSG

Copy link
Copy Markdown
Contributor

Issue for tracking pending mimetypes: #19573

@lock lock Bot locked as resolved and limited conversation to collaborators Aug 9, 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.

Code files are not detected as text files with code icon.

8 participants