Fixing the "URI signature match failed" error while displaying Reddit Images

Shawn Rebello

While trying to pull images from Reddit using its json API for an app I ran into a strange error,
Using the extracted image url, a few images would load perfectly but others would fail.

Solution

Digging a little deeper, it is clear that the image url  supplied by the reddit api is incorrect. Attempting to open the url in the browser gives the error:
URI signature match failed.

Consider the following url supplied by reddit:


Replacing the & amp ; with a & will return the correct image url.


*As of 14-2-2017, this issue still persists.

So this can be fixed by replacing all instances of & with & which can be done with regex in all most every language.
Since I'm working with Angular at the moment, I wrote a simple ts fix:


 let oldURL: string = "https://i.reddituploads.com/3ac211e88e214eff9113fa4ed2f3635e?fit=max&h=1536&w=1536&s=b545edd8de65c9bb18bcca7d38aad0b7";
 let newURL: string = oldURL.replace(/&/g,"&");


Note the g after /&/ that is to make sure multiple occurrences of the string matching are replaced.
Hope this helps!

Shawn Rebello / Author & Editor

Shawn Rebello is an engineering student who likes learning new languages, tools, libraries or frameworks. When he is not coding, he binge watches TV shows and spends time on Wikipedia and Reddit.

15 comments :

  1. Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a Front end developer learn from Javascript Training in Chennai . or Javascript Training in Chennai. Nowadays JavaScript has tons of job opportunities on various vertical industry. ES6 Training in Chennai

    ReplyDelete
  2. I appreciate your efforts because it conveys the message of what you are trying to say. It's a great skill to make even the person who doesn't know about the subject could able to understand the subject . Your blogs are understandable and also elaborately described. I hope to read more and more interesting articles from your blog. All the best.

    rpa training in bangalore
    best rpa training in bangalore
    RPA training in bangalore
    rpa course in bangalore
    rpa training in chennai
    rpa online training

    ReplyDelete
  3. Thank you for benefiting from time to focus on this kind of, I feel firmly about it and also really like comprehending far more with this particular subject matter. In case doable, when you get know-how, is it possible to thoughts modernizing your site together with far more details? It’s extremely useful to me
    python Course in Pune
    python Course institute in Chennai
    python Training institute in Bangalore

    ReplyDelete

  4. Does your blog have a contact page? I’m having problems locating it but, I’d like to shoot you an email. I’ve got some recommendations for your blog you might be interested in hearing.
    AWS Training in Chennai |AWS Training Course in Chennai
    AWS Training in Chennai | AWS Training in Chennai cost
    AWS Training in Chennai | Aws Training Institute in Chennai

    ReplyDelete

  5. Your good knowledge and kindness in playing with all the pieces were very useful. I don’t know what I would have done if I had not encountered such a step like this.
    microsoft azure training in bangalore
    rpa training in bangalore
    best rpa training in bangalore
    rpa online training

    ReplyDelete
  6. Excellent post!!!. The strategy you have posted on this technology helped me to get into the next level and had lot of information in it.
    AWS training in sholinganallur
    AWS training in Tambaram
    AWS training in Velachery

    ReplyDelete
  7. Nice This Post And Great Your Article This Information Very Use full For Me Thank You For Sharing This Information. Guide to Recovering Data From Hard Drive Yourself

    ReplyDelete
  8. I play a lot and win, what are you capable of? best online casino games with us Play, win or be defeated.

    ReplyDelete
  9. The Viper SmartStart GPS is a tracker for car created by a few of the top-rated automobile alarm makers. viper smart login

    ReplyDelete
  10. Looking for pokezz com alternatives for Pokemon Go Hacks.

    ReplyDelete
  11. Ahhh I'm so glad I stumbled upon this site. I was very lucky literally in the first two hours I earned in more than one working day, you also want? hold on useful play casino You can not thank

    ReplyDelete
  12. Python is a general-purpose interpreted, interactive, object-oriented and high-level programming language. Currently Python is the most popular Language in IT. Python adopted as a language of choice for almost all the domain in IT including Web Development


    myTectra Amazon Web Services (AWS) certification training helps you to gain real time hands on experience on AWS. myTectra offers AWS training in Bangalore using classroom and AWS Online Training globally.
    Read more

    ReplyDelete
  13. Really very happy to say that your post is very interesting. I never stop myself to say something about it. You did a great job. Keep it up.
    We have an excellent IT courses training institute in Hyderabad. We are offering a number of courses that are very trendy in the IT industry. For further information, please once go through our site.
    AWS Training In Hyderabad

    ReplyDelete
  14. Attend The Python Training in Bangalore From ExcelR. Practical Python Training in Bangalore Sessions With Assured Placement Support From Experienced Faculty. ExcelR Offers The Python Training in Bangalore.

    ReplyDelete

Leave a comment here!