diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 09:52:52 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 09:52:52 +0000 |
commit | 424f663819ec59abc4edab03a667845835e57ac1 (patch) | |
tree | 63b79645aaee07c3de90e4b70dd8d6371faa1747 /debian/patches/1673481736.FILE5_44-15-ga2756aa5.improve-javascript-detection-fc-stegerman.patch | |
parent | Adding upstream version 1:5.44. (diff) | |
download | file-debian/1%5.44-3.tar.xz file-debian/1%5.44-3.zip |
Adding debian version 1:5.44-3.debian/1%5.44-3debian
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/patches/1673481736.FILE5_44-15-ga2756aa5.improve-javascript-detection-fc-stegerman.patch')
-rw-r--r-- | debian/patches/1673481736.FILE5_44-15-ga2756aa5.improve-javascript-detection-fc-stegerman.patch | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/debian/patches/1673481736.FILE5_44-15-ga2756aa5.improve-javascript-detection-fc-stegerman.patch b/debian/patches/1673481736.FILE5_44-15-ga2756aa5.improve-javascript-detection-fc-stegerman.patch new file mode 100644 index 0000000..f0b5529 --- /dev/null +++ b/debian/patches/1673481736.FILE5_44-15-ga2756aa5.improve-javascript-detection-fc-stegerman.patch @@ -0,0 +1,103 @@ +Subject: Improve JavaScript detection (FC Stegerman) +Origin: FILE5_44-15-ga2756aa5 <https://github.com/file/file/commit/FILE5_44-15-ga2756aa5> +Upstream-Author: Christos Zoulas <christos@zoulas.com> +Date: Thu Jan 12 00:02:16 2023 +0000 + +--- a/magic/Magdir/javascript ++++ b/magic/Magdir/javascript +@@ -3,18 +3,68 @@ + # $File: javascript,v 1.4 2022/09/02 08:08:17 christos Exp $ + # javascript: magic for javascript and node.js scripts. + # +-0 string/w #!/bin/node Node.js script text executable ++0 string/tw #!/bin/node Node.js script executable + !:mime application/javascript +-0 string/w #!/usr/bin/node Node.js script text executable ++0 string/tw #!/usr/bin/node Node.js script executable + !:mime application/javascript +-0 string/w #!/bin/nodejs Node.js script text executable ++0 string/tw #!/bin/nodejs Node.js script executable + !:mime application/javascript +-0 string/w #!/usr/bin/nodejs Node.js script text executable +-!:mime application/javascript +-0 string #!/usr/bin/env\ node Node.js script text executable +-!:mime application/javascript +-0 string #!/usr/bin/env\ nodejs Node.js script text executable ++0 string/tw #!/usr/bin/nodejs Node.js script executable + !:mime application/javascript ++0 string/t #!/usr/bin/env\ node Node.js script executable ++!:mime application/javascript ++0 string/t #!/usr/bin/env\ nodejs Node.js script executable ++!:mime application/javascript ++ ++# JavaScript ++# The strength is increased to beat the C++ & HTML rules ++0 search "use\x20strict" JavaScript source ++!:strength +30 ++!:mime application/javascript ++!:ext js ++0 search 'use\x20strict' JavaScript source ++!:strength +30 ++!:mime application/javascript ++!:ext js ++0 regex module(\\.|\\[["'])exports.*= JavaScript source ++!:strength +30 ++!:mime application/javascript ++!:ext js ++0 regex \^(const|var|let).*=.*require\\( JavaScript source ++!:strength +30 ++!:mime application/javascript ++!:ext js ++0 regex \^export\x20(function|class|default|const|var|let|async)\x20 JavaScript source ++!:strength +30 ++!:mime application/javascript ++!:ext js ++0 regex \\((async\x20)?function[(\x20] JavaScript source ++!:strength +30 ++!:mime application/javascript ++!:ext js ++0 regex \^(import|export).*\x20from\x20 JavaScript source ++!:strength +30 ++!:mime application/javascript ++!:ext js ++0 regex \^(import|export)\x20["']\\./ JavaScript source ++!:strength +30 ++!:mime application/javascript ++!:ext js ++0 regex \^require\\(["'] JavaScript source ++!:strength +30 ++!:mime application/javascript ++!:ext js ++0 regex typeof.*[!=]== JavaScript source ++!:strength +30 ++!:mime application/javascript ++!:ext js ++ ++# React Native minified JavaScript ++0 search/128 __BUNDLE_START_TIME__= React Native minified JavaScript ++!:strength +30 ++!:mime application/javascript ++!:ext bundle/jsbundle ++ + # Hermes by Facebook https://hermesengine.dev/ + # https://github.com/facebook/hermes/blob/master/include/hermes/\ + # BCGen/HBC/BytecodeFileFormat.h#L24 +--- a/magic/Magdir/sgml ++++ b/magic/Magdir/sgml +@@ -50,6 +50,16 @@ + !:mime text/html + !:strength + 5 + ++# avoid misdetection as JavaScript ++0 string/cWt \<!doctype\ html HTML document text ++!:mime text/html ++0 string/ct \<html> HTML document text ++!:mime text/html ++0 string/ct \<!-- ++>&0 search/4096/cWt \<!doctype\ html HTML document text ++>&0 search/4096/ct \<html> HTML document text ++!:mime text/html ++ + # SVG document + # https://www.w3.org/TR/SVG/single-page.html + 0 search/4096/cWbt \<!doctype\ svg SVG XML document |