Bug 416223 - html files are sometimes recognized as application/x-perl based on "use strict" file content
Summary: html files are sometimes recognized as application/x-perl based on "use stric...
Status: RESOLVED UPSTREAM
Alias: None
Product: dolphin
Classification: Applications
Component: view-engine: details mode (show other bugs)
Version: 18.04.3
Platform: Kubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: Dolphin Bug Assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-01-13 22:25 UTC by Mike L
Modified: 2020-01-14 08:35 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mike L 2020-01-13 22:25:35 UTC
SUMMARY
html files are sometimes recognized as application/x-perl based on "use strict" file content

In the presence of the string "use strict" inside a script tag in an html file, the filetype recognition is flaky.

I recently installed the OS clean and copied over some stuff in .config, .local, and .kde, so that may be a factor.

STEPS TO REPRODUCE
1. open html file (see ADDITIONAL INFORMATION below)
2. make indicated edits
3. view changed filetype in dolphin
4. there are a couple cases I can't repro atm where uncommenting the script tag in the header (or removing it entirely) would switch it one way or the other

OBSERVED RESULT
filetype changes to application/x-perl
icon, properties, and click action change
launching html files from applications (e.g. dropbox) opens them in kate (don't know if that action is using dolphin or if both are using something else)

EXPECTED RESULT
should still be recognized as html

I think kde/ubuntu shouldn't be trying this hard to determine filetype. Command line 'file' command works fine.
Maybe not specific to dolphin?


SOFTWARE/OS VERSIONS
Kernel: 5.0.0-37-generic
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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Long running task broken up with timers</title>
<!--<script src="../assert.js"></script>-->
</head>
<body>
if you do any of:
ignore this line
ignore this line
remove last four lines of this text OR remove last single line of this text and the title and script tag in the header
then kubuntu thinks this file is application/x-perl
<script>
"use strict";
</script>
</body>
</html>
Comment 1 Kai Uwe Broulik 2020-01-14 08:35:52 UTC
I'd say this is a bug in shared mime info, please report it there: https://gitlab.freedesktop.org/xdg/shared-mime-info/issues