format MimeTypeHelper

This commit is contained in:
Lera Elvoé 2022-06-29 13:36:41 +03:00
parent 12090f7930
commit fc1ca1e1b0

View File

@ -11,7 +11,7 @@ enum SOURCE{
const UTF8 := "UTF-8"
class MimeType:
var full_type := "application/octet-stream"
var type := "application"
var sub_type := "octet-stream"
@ -49,20 +49,20 @@ class MimeTypeDb:
func process_raw_db(raw_db: Dictionary) -> void:
for type in raw_db:
var mime_type := MimeType.new()
mime_type.setup(type, raw_db[type])
if not mime_type.extensions or type == _default_mime_type.type:
continue;
for extension in mime_type.extensions:
if extension in _types and (_types[extension] as MimeType).source > mime_type.source:
continue
_types[extension] = mime_type
func get(ext_or_filename: String) -> MimeType:
var ext := ("x."+ext_or_filename.trim_prefix(".")).get_extension().to_lower()
if not (ext in _types):