Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
23 changes: 22 additions & 1 deletion lib/marcel/mime_type/definitions.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,28 @@
# frozen_string_literal: true

Marcel::MimeType.extend "text/plain", extensions: %w( txt asc )
Marcel::MimeType.extend "text/html", magic: [[0..64, "<!DOCTYPE HTML"], [0..64, "<!DOCTYPE html"], [0..64, "<!doctype HTML"], [0..64, "<!doctype html"]]

Marcel::Magic.remove("text/html")
Marcel::MimeType.extend "text/html",
extensions: %w( html htm ),
magic: [
[0, "<!DOCTYPE html"],
[0, "<!DOCTYPE HTML"],
[0, "<!doctype html"],
[0, "<!doctype HTML"],
[0, "<html"],
[0, "<HTML"],
[0, " <!DOCTYPE html"],
[0, "\n<!DOCTYPE html"],
[0, "\r<!DOCTYPE html"],
[0, "\r\n<!DOCTYPE html"],
[0, "\t<!DOCTYPE html"],
[0, " <html"],
[0, "\n<html"],
[0, "\r<html"],
[0, "\r\n<html"],
[0, "\t<html"]
]

Marcel::MimeType.extend "application/illustrator", parents: "application/pdf"
Marcel::MimeType.extend "image/vnd.adobe.photoshop", magic: [[0, "8BPS"]], extensions: %w( psd psb )
Expand Down
3 changes: 2 additions & 1 deletion test/fixtures/name/application/json/json.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"name": "JSON"
"name": "JSON",
"tag": "<html></html>"
}
4 changes: 2 additions & 2 deletions test/fixtures/name/text/csv/csv.csv
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Name,Age,Occupation
Marcel Marceau,94,Mime
Name,Age,Occupation,Quote
Marcel Marceau,94,Mime,I used to develop in <html> a lot but now it's just some <body> that I used to know