Skip to content

Commit

Permalink
Add svg support (#58)
Browse files Browse the repository at this point in the history
* Add support for SVG

* Add check for SVG

* Update pattern-tree.ts

---------

Co-authored-by: Lars Kölpin-Freese <LarsKoelpin@users.noreply.github.com>
  • Loading branch information
alexkiro and LarsKoelpin authored Feb 29, 2024
1 parent bae3520 commit fab5fb6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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");
});
});
5 changes: 5 additions & 0 deletions src/model/pattern-tree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1331,4 +1331,9 @@ add(
}
);

add("SVG", ["0x3c", "0x73", "0x76", "0x67"], {
mime: "image/svg+xml",
extension: "svg",
});

export default (): Tree => tree as Tree;
1 change: 1 addition & 0 deletions src/testfiles/a.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit fab5fb6

Please sign in to comment.