"URIError: URI malformed" error while updating a post -> How to solve

in #hive4 years ago (edited)

Has it ever happened to you?

You start editing a post on https://hive.blog, make a thousand changes and when you finally try to show the world what a wonderful post you put together.. it does not let you. A red nasty error saying "URI malformed" appears on top of the Update Post button and you stop and wonder why life is such a bitch. 😅😅😅😅😅😅

This was happening on Steemit too and my finding is that it seems to happen only when you edit a post that contains emojis.

The solution is either to remove all emojis or, if you really wanna keep that beer emoji in your post because it gives your post a next level meaning and you really can't live without it, simply paste this script in your browser Console (Ctrl + Shift + J on Linux/Windows and Cmd + Opt + J on Mac) and it will finally let you publish your precious changes.

var originalEu = encodeURI;
encodeURI = (...args) => {
  try {
    return originalEu(...args);
  } catch (err) {
    console.error('Caught Error:', err);
    if (`${err}`.includes('URI malformed')) {
      console.log('Args causing issue:', ...args);
    }
  }
};



Hope this helps and that if someone googles that error message + "hive" they'll find this workaround.

Bear in mind though that this is a temporary solution. When you close the tab this workaround will stop working and you'll have to re-execute it the next time you come across this issue.
Maybe @quochuy will take a look at the root cause of this bug when he has a chance? 🙃🙃🙃🙃🙃

PS. Forgot to mention, I have never seen this bug on Peakd so switching to it to publish your posts should be a solution too.

Take care 😎👍🤝

🤝

Sort:  

Awesome, thanks @quochuy!

Just checked it, the error is actually only editing a post with an emoji, not creating it.

I cannot always reproduce it though. For instance if I edit this post all is fine.

I can still reproduce it on this post though: https://hiveblocks.com/bitcoin/@gaottantacinque/the-moment-you-find-out-your-btc-bip38-passphrase-does-not-work

In the latter please ignore the extra <i> around the emojis. The first time using those it allowed me to publish my edits but it worked only the first time. Then I had to use my hack to swallow the error.

👍

.

Thank you for your witness vote!
Have a !BEER on me!
To Opt-Out of my witness beer program just comment STOP below


Hey @gaottantacinque, here is a little bit of BEER from @isnochys for you. Enjoy it!

Did you know that <a href='https://dcity.io/cityyou can use BEER at dCity game to buy cards to rule the world.

Thank you for your witness vote!
Have a !BEER on me!
To Opt-Out of my witness beer program just comment STOP below


Hey @gaottantacinque, here is a little bit of BEER from @isnochys for you. Enjoy it!

Learn how to earn FREE BEER each day by staking your BEER.

Upvoted by GITPLAIT!

We have a curation trial on Hive.vote. you can earn a passive income by delegating to @gitplait
We share 80 % of the curation rewards with the delegators.


To delegate, use the links or adjust 10HIVE, 20HIVE, 50HIVE, 100HIVE, 200HIVE, 500HIVE, 1,000HIVE, 10,000HIVE, 100,000HIVE


Join the Community and chat with us on Discord let’s solve problems & build together.