Page MenuHomeSolus

Mimetype lookup broken in Go
Closed, WontfixPublic


The lookup of mimetypes is broken when using Go on Solus. I ran into this when running the tests inside, where all the mime related tests are failing when running them here on Solus. Installing httpd and symlinking the mime types using sudo ln -s /usr/share/defaults/httpd/mime.types /etc/mime.types fixes it. This is because of how Go looks up the MimeType information. See for the available lines.

There are who possible issues at play here depending on how you look at it. I would say that the issue partly lies in Go and the other one in Solus. We are currently lacking a global mime type file for listing all the available mime types (such as /etc/mime.types, related to T8386). Go also does not support for example /usr/share/defaults/httpd/mime.types that our httpd package provides.

My suggestion is that we either add a global /etc/mime.types or a more stateless version in /usr/share/defaults/mime.types (the latter requiring a PR upstream to Go or patch downstream). This would avoid people needing to download httpd to get mime stuff working, which for obvious reasons is not a very user friendly solution.

Related Objects

Event Timeline

Jacalz created this task.Nov 22 2020, 5:19 PM
JoshStrobl closed this task as Wontfix.EditedNov 22 2020, 5:54 PM
JoshStrobl edited projects, added Upstream Issue; removed Software.
JoshStrobl added a subscriber: JoshStrobl.

We're not going to have neither of those files because it shouldn't be used at all (e.g. for by normal desktop applications, which is the primary target of Solus), you don't need httpd/nginx for anything unless:

a. You're dealing with a mimetype that is outside of the built-in ones, at which point you're using Golang as a backend and using httpd / nginx as a reverse proxy, so you're going to likely have those files installed anyways, so the point is moot
b. You're writing a specific CLI-based utility intended for the desktop, at which point you should support the proper database generated by mime tools.

Realistically golang should implement support for reading /usr/share/mime/globs to match extensions with mimetypes generations by update-mime-database, or this could be trivially done through a separate package.

I'd suggest filing your issue upstream, since they're making assumptions about the operating system that really shouldn't be made.

Alright then. Will do so :)