cannot handle svg file
Closed this issue · 3 comments
ladyrick commented
ladyrick commented
I find that fromBuffer
cannot detect a svg file. It just returns an undefined
.
I tried to change if (fileExt == "xml")
to if (!fileExt)
, the bug disappeared.
I hope this bug can be fixed.
export async function fileExtByContent(content: ArrayBuffer) {
const fileExt = (await fromBuffer(content))?.ext;
// if XML, probably it is SVG
if (fileExt == "xml") {
const buffer = Buffer.from(content);
if (isSvg(buffer)) return "svg";
}
return fileExt;
}
Sergei-Korneev commented
Thank you. Will check this later.
Sergei-Korneev commented
Try new version.