Skip to content

mime detection when file is smaller than region_len / range-length #15

@iyzana

Description

@iyzana

The shared-mime-info-spec does not mention it but I assume this check is incorrect

if (file.len()) < bound_max {
return false;
}

As an example it prevents mime-type detection of this short html file.

<!DOCTYPE HTML>
<html>
  <head>
    <title>Test</title>
  </head>
  <body></body>
</html>

The magic file contains the following rule for text/html

>0=\x00\x0E<!DOCTYPE HTML+257

setting a range-length of 257 bytes preventing detection of the 90 byte html file.

My interpretation of the spec is that the first range-length bytes should be searched for the value, but not that the file needs to be at least range-length bytes long.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions