forked from platypush/platypush
Get the original MIME type for symlinks.
If the target resource is a symbolic link, then `get_mime_type` should retrieve the MIME type of the linked resource.
This commit is contained in:
parent
1e9418b072
commit
0010342fb7
1 changed files with 5 additions and 1 deletions
|
@ -413,7 +413,11 @@ def get_mime_type(resource: str) -> Optional[str]:
|
|||
)
|
||||
|
||||
if mime:
|
||||
return mime.mime_type if hasattr(mime, 'mime_type') else mime # type: ignore
|
||||
mime_type = mime.mime_type if hasattr(mime, 'mime_type') else mime # type: ignore
|
||||
if mime_type == 'inode/symlink':
|
||||
mime_type = get_mime_type(os.path.realpath(resource))
|
||||
|
||||
return mime_type
|
||||
|
||||
return None
|
||||
|
||||
|
|
Loading…
Reference in a new issue