diff --git a/src/index.spec.ts b/src/index.spec.ts index 9b89ddc..e21e3b3 100644 --- a/src/index.spec.ts +++ b/src/index.spec.ts @@ -244,4 +244,11 @@ describe("Tests the public API", () => { const result = filetypemime(file); expect(result).toContain("image/jpeg"); }); + + it("detects svg", () => { + // File created using https://png2jpg.com + const file = getBytes("a.svg"); + const result = filetypemime(file); + expect(result).toContain("image/svg+xml"); + }); }); diff --git a/src/model/pattern-tree.ts b/src/model/pattern-tree.ts index ba882c2..1f34129 100644 --- a/src/model/pattern-tree.ts +++ b/src/model/pattern-tree.ts @@ -1331,4 +1331,9 @@ add( } ); +add("SVG", ["0x3c", "0x73", "0x76", "0x67"], { + mime: "image/svg+xml", + extension: "svg", +}); + export default (): Tree => tree as Tree; diff --git a/src/testfiles/a.svg b/src/testfiles/a.svg new file mode 100644 index 0000000..706d496 --- /dev/null +++ b/src/testfiles/a.svg @@ -0,0 +1 @@ +