Foam Guppies
Foam Guppies

Reputation: 23

How should I specify a URI in the SophosLabs Intelix Malware and Productivity URL Lookup API?

I'm trying to use the Malware and Productivity URL Lookup API to perform a lookup for a URI. The documentation suggests the form should be:

[ scheme ":" "//" ] [ userinfo "@" ] host [ ":" port ] path-abempty [ "?" query ] [ "#" fragment ]

yet I'm getting the following results:

Code is JavaScript, and the URI are passed in as

encodeURI(linktocheck)

, but I'm getting the same results without encodeURI.

How should the URI be specified?

Upvotes: 2

Views: 71

Answers (1)

Phil Cole
Phil Cole

Reputation: 26

Try using

encodeURIComponent(linktocheck)

instead.

From the docs, https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURI

encodeURI escapes all characters except:

Not Escaped:

    A-Z a-z 0-9 ; , / ? : @ & = + $ - _ . ! ~ * ' ( ) #

whereas encodeURIComponent escapes all characters except:

Not Escaped:

    A-Z a-z 0-9 - _ . ! ~ * ' ( )

Upvotes: 1

Related Questions