cancel
Showing results for 
Search instead for 
Did you mean: 

How to avoid double encoding issue for URI in Snaplogic?

PriyaBodireddy
New Contributor

While processing a Azure blob storage file in Snaplogic, Snaplogic is not able to read it as its encountering with double encoding issue.

I have already tried below method to handle double encoding to fix it and worked well but encountering with other issues due to this.
Example URI :
https://myaccount.blob.core.windows.net/sascontainer/sasblob.txt?sv=2015-04-05&st=2015-04-29T22%3A18...
Endindex : $data.indexOf(“?”)

Startindex : $data.search(“sascontainer /”)+11

Head: $.data.slice(0,$.startIndex)

Middle : encodeURIComponent(decodeURIComponent($.data.slice($.startIndex,$.endIndex)))

Tail : $.data.slice($.endIndex)
Rest GET service URL: Head + Middle + Tail
above logic is used in Rest GET to read the service url by decoding and encoding only middle part. However this method is also failing even though it handled double encoding as its decoding everything instead of only decoding hexadecimal values of URL.

Is there any other method to decode only those hexadecimal values present in URI and encode whole URI on top of it?

3 REPLIES 3

ptaylor
Employee
Employee

Have you tried using the File Reader snap? It has a checkbox setting called Prevent URL encoding. Please try using that and see if it succeeds.

yes we tried it but that doesn’t fit our requirement. As we will be receiving any type of file like excel or pdf or jpg etc. from source, even if it pass through the file reader but cannot pass through parser because parser should be flexible to handle any type of file whereas SnapLogic don’t have such kind of snap to parse.

Hi Priya,

Good day, see attached PoC pipeline that will breakdown the uri, instead of rebuilding the uri by string concatenation, I use the rest get snap query parameters property (assuming the number of parameters [8] is static )

canvas_2023_01_10.slp (17.5 KB)

image

Thanks,
EmEm