mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-06-08 04:09:15 -04:00
fix(clipboard): prefer image MIME types over text fallbacks (#2551)
This commit is contained in:
@@ -572,16 +572,16 @@ func (m *Manager) hasSensitiveMimeType(mimes []string) bool {
|
|||||||
func (m *Manager) selectMimeType(mimes []string) string {
|
func (m *Manager) selectMimeType(mimes []string) string {
|
||||||
preferredTypes := []string{
|
preferredTypes := []string{
|
||||||
"text/uri-list",
|
"text/uri-list",
|
||||||
"text/plain;charset=utf-8",
|
|
||||||
"text/plain",
|
|
||||||
"UTF8_STRING",
|
|
||||||
"STRING",
|
|
||||||
"TEXT",
|
|
||||||
"image/png",
|
"image/png",
|
||||||
"image/jpeg",
|
"image/jpeg",
|
||||||
"image/gif",
|
"image/gif",
|
||||||
"image/bmp",
|
"image/bmp",
|
||||||
"image/tiff",
|
"image/tiff",
|
||||||
|
"text/plain;charset=utf-8",
|
||||||
|
"text/plain",
|
||||||
|
"UTF8_STRING",
|
||||||
|
"STRING",
|
||||||
|
"TEXT",
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, pref := range preferredTypes {
|
for _, pref := range preferredTypes {
|
||||||
|
|||||||
@@ -410,6 +410,8 @@ func TestSelectMimeType(t *testing.T) {
|
|||||||
{[]string{"text/plain;charset=utf-8", "text/html"}, "text/plain;charset=utf-8"},
|
{[]string{"text/plain;charset=utf-8", "text/html"}, "text/plain;charset=utf-8"},
|
||||||
{[]string{"text/html", "text/plain"}, "text/plain"},
|
{[]string{"text/html", "text/plain"}, "text/plain"},
|
||||||
{[]string{"text/html", "image/png"}, "image/png"},
|
{[]string{"text/html", "image/png"}, "image/png"},
|
||||||
|
{[]string{"image/png", "text/plain"}, "image/png"},
|
||||||
|
{[]string{"text/plain", "image/png"}, "image/png"},
|
||||||
{[]string{"image/png", "image/jpeg"}, "image/png"},
|
{[]string{"image/png", "image/jpeg"}, "image/png"},
|
||||||
{[]string{"image/png"}, "image/png"},
|
{[]string{"image/png"}, "image/png"},
|
||||||
{[]string{"application/octet-stream"}, "application/octet-stream"},
|
{[]string{"application/octet-stream"}, "application/octet-stream"},
|
||||||
|
|||||||
Reference in New Issue
Block a user