https://bugs.kde.org/show_bug.cgi?id=417761

            Bug ID: 417761
           Summary: kmimetypefinder5 misidentifies mimetype of python
                    files containing certain strings
           Product: kde-cli-tools
           Version: 5.12.8
          Platform: Other
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: aleix...@kde.org
          Reporter: nathanielmbea...@gmail.com
  Target Milestone: ---

SUMMARY
Python scripts with a string containing HTML can be misidentified as HTML files
by kmimetypefinder5.


STEPS TO REPRODUCE
1. Create python file "example.py" that looks like this:

#! /usr/bin/env python3
example_string = \
"""\
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml";>
  <head>
    <title>Example title</title>
  </head>
  <body>
    <p>Example body</p>
  </body>
</html>
"""
print('Hello, world!')

2. Run kmimetypefinder5 on that file.

$ kmimetypefinder5 example.py 

OBSERVED RESULT

$ kmimetypefinder5 example.py 
application/xhtml+xml

EXPECTED RESULT

$ kmimetypefinder5 example.py
text/x-python

or

$ kmimetypefinder5 example.py
text/plain


SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 5.12.9
KDE Frameworks Version: 5.44.0
Qt Version: 5.9.5

ADDITIONAL INFORMATION

$ lsb_release -rd
Description:    Ubuntu 18.04.3 LTS
Release:        18.04
$ apt-cache policy kde-cli-tools
kde-cli-tools:
  Installed: 4:5.12.8-0ubuntu0.1
  Candidate: 4:5.12.8-0ubuntu0.1
  Version table:
 *** 4:5.12.8-0ubuntu0.1 500
        500 http://us.archive.ubuntu.com/ubuntu bionic-updates/universe amd64
Packages
        100 /var/lib/dpkg/status
     4:5.12.4-0ubuntu1 500
        500 http://us.archive.ubuntu.com/ubuntu bionic/universe amd64 Packages

Downstream bug report:

https://bugs.launchpad.net/ubuntu/+source/kde-cli-tools/+bug/1857824

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to