I’ve recently converted our web areas from the system engine to the embedded Blink engine and found that WA Get last filtered URL behaves (I think) incorrectly with the embedded engine.
Given the following filtered url, file:///C:/Desktop%20Folder/4D%20v18/Sandbox.4dbase/Resources/test.html?key=This%26that
the command returns the string with the encoded special characters resolved to their actual character, e.g. file:///C:/Desktop Folder/4D v18/Sandbox.4dbase/Resources/test.html?key=This&that
which is not a valid URL.
This means that I can’t parse the query string since I don’t know whether the & character is part of the value of key or signifying a new key called that.
Has anyone else encountered this issue?
My testing has been on Windows 10 with v17 R6 and v18.
Test on my system show same behavior
: ($form_event=On URL Filtering)
$LastFilteredURL:=WA Get last filtered URL($ptrWAvar->) // gets decoded URL
OPEN URL($LastFilteredURL) // 4D auto encodes the URL
WA Get last filtered URL definitely shouldn’t be decoding anything. It should be returning the exact filtered URL.
Consider the URL https://mydomain.com/page.html?q=this%26that%3Dstuff&r=6
The value of q is this&that=stuff and the value of r is 6.
But if that URL is filtered in a web area, WA Get last filtered URL returns https://mydomain.com/page.html?q=this&that=stuff&r=6
Now the value of q is this, plus there is a new key in the query string that which has the value stuff.
When I passed that filtered URL to OPEN URL it didn’t encode the query string so it opened the URL with the wrong query string. It makes sense that it wouldn’t encode the & and = characters in the query string as that would make the query string invalid.
WA Get last filtered URL needs to do the same thing as OPEN URL and leave the query string unchanged.
Yes i think too the decoded url version of “?q=this%26that%3Dstuff&r=6”
must maybe total same as encoded one
and it is maybe a mistake to translate %26(&) %3D(=) inside a q-par-value.
And i think too, maybe it is better all Get-URL commands gets the original encoded URL and not the translated to decoded url one.
Use “encodeURIComponent” only for separatly encode the value of a URL query parameter.
Only the VALUEs of a URL query parameter must encode/decode separat
(split url and queryString before encode/decode it in parts).