Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@file-type/xml

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@file-type/xml - npm Package Compare versions

Comparing version 0.2.0 to 0.2.1

26

lib/index.js

@@ -86,14 +86,18 @@

constructor() {
constructor(options) {
this.options = options ?? {};
this.firstTag = true;
this.onEnd = false;
this.parser = sax.parser(true);
this.depth = 0;
this.validClose = false;
this.nesting = 0;
this.parser.onerror = e => {
if (e.message.startsWith('Invalid character entity')) { // Allow entity reference
return;
}
this.fileType = undefined;
this.onEnd = true;
};
this.parser.onopentag = node => {
++this.depth;
++this.nesting;
if (!this.firstTag || this.onEnd) {

@@ -112,9 +116,10 @@ return;

if (this.fileType) {
if (this.fileType && !this.options.fullScan) {
this.onEnd = true;
}
};
this.parser.onend = () => {
this.onEnd = true;
};
this.parser.onclosetag = () => {
--this.nesting;
}
}

@@ -130,2 +135,6 @@

}
isValid() {
return this.nesting === 0;
}
}

@@ -144,3 +153,2 @@

await tokenizer.ignore(offset);
let fileType;

@@ -147,0 +155,0 @@ const xmlTextDetector = new XmlTextDetector();

{
"name": "@file-type/xml",
"version": "0.2.0",
"version": "0.2.1",
"description": "XML detection plugin",

@@ -5,0 +5,0 @@ "type": "module",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc