Skip to content

Commit

Permalink
Merge pull request #368 from Fdawgs/perf/opts
Browse files Browse the repository at this point in the history
  • Loading branch information
Fdawgs authored Apr 30, 2024
2 parents c601140 + 37fcb3b commit e4d3448
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,9 @@ class UnRTF {
throw new Error("File missing");
}
// Check for RTF specific magic number
if (!buff.toString().startsWith(rtfMagicNumber)) {
if (
buff.toString().slice(0, rtfMagicNumber.length) !== rtfMagicNumber
) {
throw new Error(
"File is not the correct media type, expected 'application/rtf'"
);
Expand Down
6 changes: 5 additions & 1 deletion src/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ let testBinaryPath;
switch (process.platform) {
// macOS
case "darwin":
testBinaryPath = "/usr/local/bin";
if (process.arch === "arm64") {
testBinaryPath = "/opt/homebrew/bin";
} else {
testBinaryPath = "/usr/local/bin";
}
break;

case "linux":
Expand Down

0 comments on commit e4d3448

Please sign in to comment.