Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add html utf8 bom signature #268

Merged
merged 8 commits into from
Apr 17, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions internal/magic/text.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
var (
// HTML matches a Hypertext Markup Language file.
HTML = markup(
append([]byte{0xEF, 0xBB, 0xBF}, []byte("<!DOCTYPE HTML")...),
napalu marked this conversation as resolved.
Show resolved Hide resolved
napalu marked this conversation as resolved.
Show resolved Hide resolved
[]byte("<!DOCTYPE HTML"),
[]byte("<HTML"),
[]byte("<HEAD"),
Expand Down
2 changes: 2 additions & 0 deletions mimetype_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ var files = map[string]string{
"html.svg.html": "text/html; charset=utf-8",
"html.usascii.html": "text/html; charset=us-ascii",
"html.utf8.html": "text/html; charset=utf-8",
"html.utf8bom.html": "text/html; charset=utf-8",
"html.bomws.html": "text/html; charset=utf-8",
"html.withbr.html": "text/html; charset=utf-8",
"ico.ico": "image/x-icon",
"ics.dos.ics": "text/calendar",
Expand Down
23 changes: 23 additions & 0 deletions testdata/html.utf8bom.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!DOCTYPE html>
<!--
Some comment

-->
<html dir="ltr" mozdisallowselectionprint>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="some name" content="notranslate">
<title>test</title>


<link rel="stylesheet" href="html.utf8bom.css">



</head>

<body tabindex="1">
<div id="printContainer"></div>
</body>
</html>
24 changes: 24 additions & 0 deletions testdata/html.utf8bomws.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@

<!DOCTYPE html>
<!--
Some comment

-->
<html dir="ltr" mozdisallowselectionprint>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="some name" content="notranslate">
<title>test</title>


<link rel="stylesheet" href="html.utf8bom.css">



</head>

<body tabindex="1">
<div id="printContainer"></div>
</body>
</html>