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.


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 = "";
 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.


  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

  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


Leave a comment here!