]> Cypherpunks.ru repositories - gostls13.git/commit
mime: support reading shared mime-info database on unix systems
authorJacalz <jacob.alzen@gmail.com>
Fri, 9 Apr 2021 14:57:59 +0000 (14:57 +0000)
committerIan Lance Taylor <iant@golang.org>
Mon, 12 Apr 2021 21:04:48 +0000 (21:04 +0000)
commit3e8ba91275cdeb0af4c8b30f9cc788fd42cfbbd3
tree0dddd00ba8fc1b91fa19b29380e5117b1080c449
parent1b736b3c19375f6ebd0d834c02316fb13700be27
mime: support reading shared mime-info database on unix systems

This adds support for reading the FreeDesktop Shared MIME-info Database on Unix systems, if it exists.
It should make lookups work on systems where the mime.types files are not present and
should lead to better mimetype lookup in general. If the shared mimetype database does not exist,
we will fall back to reading mime.types files in common locations.

Related to a bug on Solus bugtracker: https://dev.getsol.us/T9394
This change makes the mime package work on Solus.

Change-Id: If330c22ffe523bf31f7f10807a54fc8858517055
GitHub-Last-Rev: d5fbe8c41a9d975029b35498183a0f5a40df8e6a
GitHub-Pull-Request: golang/go#45271
Reviewed-on: https://go-review.googlesource.com/c/go/+/305230
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Tobias Klauser <tobias.klauser@gmail.com>
src/mime/testdata/test.types.globs2 [new file with mode: 0644]
src/mime/type_unix.go
src/mime/type_unix_test.go [new file with mode: 0644]