-
Notifications
You must be signed in to change notification settings - Fork 619
fix(firefox): font might be undefined #541
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
💖 Thanks for opening this pull request! 💖 Please follow the contributing guidelines. And we use semantic commit messages to streamline the release process. Examples of commit messages with semantic prefixes:
Things that will help get your PR across the finish line:
We get a lot of pull requests on this repo, so please be patient and we will get back to you as soon as we can. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #541 +/- ##
=======================================
Coverage 66.50% 66.50%
=======================================
Files 10 10
Lines 612 612
Branches 150 150
=======================================
Hits 407 407
Misses 144 144
Partials 61 61 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Can you have a look at it @bubkoo, thanks :) |
@@ -203,7 +203,7 @@ async function parseWebFontRules<T extends HTMLElement>( | |||
} | |||
|
|||
function normalizeFontFamily(font: string) { | |||
return font.trim().replace(/["']/g, '') | |||
return font?.trim().replace(/["']/g, '') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return font?.trim()?.replace(/["']/g, '')
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well I'm not sure if it's needed, only font could be undefined. Trim and replace will not throw errors I guess if it's an empty string
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
only undefined will throw exception, and there are the possibilities of font coming as undefined.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, I cannot edit my code right now, I hope the maintainer could add this silent fail for fonts in a separate commit then
Description
Fix an issue on Firefox only where sometimes the font can be undefined after split.
Motivation and Context
It breaks the whole screenshot process and fails to download in Firefox because of undefined font.
Types of changes
Self Check before Merge