mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-28 10:02:14 +00:00
ADD: Determine mime type by extension if cannot open file
This commit is contained in:
parent
af6d4cda17
commit
a2e0045064
1 changed files with 7 additions and 7 deletions
|
|
@ -172,14 +172,14 @@ begin
|
|||
finally
|
||||
FileStream.Free;
|
||||
end;
|
||||
MimeType:= g_content_type_guess(Pgchar(FileName), @Buffer[0], Size, @Uncertain);
|
||||
if Assigned(MimeType) then
|
||||
begin
|
||||
Result:= StrPas(MimeType);
|
||||
g_free(MimeType);
|
||||
end;
|
||||
except
|
||||
Uncertain:= True;
|
||||
Size:= 0;
|
||||
end;
|
||||
MimeType:= g_content_type_guess(Pgchar(FileName), @Buffer[0], Size, @Uncertain);
|
||||
if Assigned(MimeType) then
|
||||
begin
|
||||
Result:= StrPas(MimeType);
|
||||
g_free(MimeType);
|
||||
end;
|
||||
if Uncertain and (Stat.st_size = 0) then
|
||||
Result:= 'text/plain';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue