-
-
Notifications
You must be signed in to change notification settings - Fork 5k
perf(open_graph): only require cheerio when content contains '<img' #3670
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
Conversation
only require cheerio when content contains '<img'
| .replace(/\n/g, ' '); // Replace new lines by spaces | ||
| } | ||
|
|
||
| if (!images.length && content) { |
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.
Is if (!images.length && content && content.includes('<img')) safe? I'm wondering if content can be null. Let me try with an empty file.
No issue/error with an empty file. Even with an empty file, it still contains basic stuff defined in a theme. So, I assume content will never be empty.
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.
Maybe some syntax error might cause content to be null, I'm not sure.
|
My preference is on #3680 |
|
Superseded by #3680 |
What does it do?
only require cheerio when content contains '<img'
How to test
Screenshots
#3663 (comment)
Pull request tasks