[Condenser] Fix issue with page not loading when json_metadata tags field contains an Array of Arrays

last month
69 in utopian-io

[Condenser] Fix issue with page not loading when json_metadata tags field contains an Array of Arrays

image.png
Img Source


Issue

https://github.com/steemit/condenser/issues/2254
When a user submits a comment that has an Array of Arrays for the tags field, Condenser breaks due to expecting a single array.

Solution

When parsing the tags, concat the arrays together to create a single Array from the multiples if they exist.

Summary

Due to the fact that users are able to submit arbitrary data in the json_metadata field that Condenser parses, users are able to completely break their own account by submitting improperly formatted tags in the json_metadata. One user in particular @makafuigdzivenu encountered this issue and is unable to load any of his pages via Condenser. This pull request contains a quick solution to the problem by just concatenating multiple arrays in the tags field to just a single array.

Example Of Improperly Formatted JSON_METADATA

  • (tags should be an Array of strings)
    json_metadata: {
      tags: [['badtag']],
      app: 'testpost',
      community: 'testpost',
      format: 'markdown+html'
    }

Shoutout to @ makafuigdzivenu for reporting the original issue on steemit/condenser

Screenshots

Improperly formatted tags breaking Condenser

screen shot 2018-01-17 at 1 15 06 pm

Improperly formatted tags concatenated into a single Array works fine

screen shot 2018-01-17 at 1 42 05 pm

Links



Posted on Utopian.io - Rewarding Open Source Contributors

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  trending
62
  ·  last month

Thank you for the contribution. It has been approved.

Nice work and a quick fix :)

You can contact us on Discord.
[utopian-moderator]

·
44
  ·  last month

Hey @reggaemuffin, I just gave you a tip for your hard work on moderation. Upvote this comment to support the utopian moderators and increase your future rewards!

50
  ·  last month

thanks for sharing very nice info @netuoso

48
  ·  last month

is that how someone can use more than 5 tags? put them in an array?

·
69
  ·  last month

You know there is no limit on tags on the blockchain right? The limits you experience are imposed by the various frontends.

·
·
48
  ·  last month

I didn't know that ':)
Than why the heck someone wants to use an array in the tags array???
Thanks for the reply.

55
  ·  last month

Well, I am glad you know what you are doing as it's all greek to me..lol

65
  ·  last month

Hey @netuoso I am @utopian-io. I have just upvoted you!

Achievements

  • Seems like you contribute quite often. AMAZING!

Community-Driven Witness!

I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!

mooncryption-utopian-witness-gif

Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x

33
  ·  last month

many thanks @netuoso for your efforts and support!