Busy.org Bug: Post with no json_metadata crashes the whole page
Project Information
- Repository: https://github.com/busyorg/busy
- Project Name: Busy
- GitHub Issue: https://github.com/busyorg/busy/issues/2019
Expected behavior
When a post doesn't contain any json_metadata the site should continue to work as normal.
Actual behavior
Any piece of code that tries to read a property of the JSON object when it's null will cause an error and the app will crash.
An example is
if (_.indexOf(postMetaData.app, 'steemit') === 0) {
canonicalHost = 'https://steemit.com';
}
postMetaData.app
will cause an error which is what can be seen in the developer console.
How to reproduce
If you got to a post with no json_metadata like this one https://busy.org/@steemed/dan-cant-censor-with-51pct the whole page crashes. If you go to a user who's reblogged it such as https://busy.org/@berniesanders the page crashes once that post is rendered
An example of a post with empty metadata
Recording Of The Bug
Crash when you visit the post
Crash when you visit the blog of someone who's reblogged the post
Possible solution
The easiest solution is to check whether the parsed json_metadata is null before trying to read properties from it. The project uses lodash so
if (_.indexOf(postMetaData.app, 'steemit') === 0) {
canonicalHost = 'https://steemit.com';
}
could become
if (_.isNull(postMetaData) || _.indexOf(postMetaData.app, 'steemit') === 0) {
canonicalHost = 'https://steemit.com';
}
However there are many ways to fix this bug so the developers may choose a different solution.
I was able to reproduce this bug on my machine.
Busy was updated this morning.
Previous bugs are now fixed. Seems new bug arrived.
Hello @jrawsthorne,
As a result of the recent update on the GitHub report of this Bug, I'll be re-scoring and provide you a feedback over this bug.
Thank you so much for creating FOSS Projects better.
Your contribution has been evaluated according to Utopian policies and guidelines, as well as a predefined set of questions pertaining to the category.
To view those questions and the relevant answers related to your post, click here.
Need help? Write a ticket on https://support.utopian.io/.
Chat with us on Discord.
[utopian-moderator]
Hello @jrawsthorne,
I am the Community Manager of Bug-hunting.
Your post is really well formatted and of high quality. Sadly, I couldn't staff-pick it this time. But, I hope to get some more great posts from you in future.
Good Work!! Keep it up
Need help? Write a ticket on https://support.utopian.io/.
Chat with us on Discord.
[Utopian-Manager]
Hi @jrawsthorne, thanks for leaving us this report.
Your post is almost perfect, possessing the attributes and makings of a staff pick. Sadly, the issue was already fixed and cannot be reproduced on staging.busy.org. I am guessing the developers at busy were aware of the bug and had it fixed prior to now. The new changes and fixes should be live on the release set for monday.
I apologise for any inconvenience encountered as a result. :(
Its great to have you with us. We look forward to your next contribution.
Need help? Write a ticket on https://support.utopian.io/.
Chat with us on Discord.
[[utopian-moderator]](https://join.utopian.io/
Thanks @fego. I'm still not sure how it has been fixed on staging because I can reproduce the bug when I run it from source. Maybe the fix hasn't been merged yet or something. Will continue to search for bugs
Hey @jrawsthorne
Thanks for contributing on Utopian.
Congratulations! Your contribution was Staff Picked to receive a maximum vote for the bug-hunting category on Utopian for being of significant value to the project and the open source community.
We’re already looking forward to your next contribution!
Want to chat? Join us on Discord https://discord.gg/h52nFrV.
Vote for Utopian Witness!
Congratulations @jrawsthorne! You have completed the following achievement on Steemit and have been rewarded with new badge(s) :
Award for the number of upvotes
Click on the badge to view your Board of Honor.
If you no longer want to receive notifications, reply to this comment with the word
STOP
Do not miss the last post from @steemitboard:
SteemitBoard World Cup Contest - Brazil vs Belgium
Participate in the SteemitBoard World Cup Contest!
Collect World Cup badges and win free SBD
Support the Gold Sponsors of the contest: @good-karma and @lukestokes