(Nodejs 11.xx) url.parse returns path escaping all backslashes

48 views
Skip to first unread message

Martin Gonzalez Glez

unread,
May 5, 2014, 5:23:28 PM5/5/14
to nod...@googlegroups.com
 
Hi,

Trying to use url.parse to process an uri retrieved from a json object, it returns the url.href, path, and everything related escaping all backslashes.
It returns:
c:%5CUsers%5CAdministrator%5CDesktop%5CTest%5Clib-local

instead of:
c:\Users\Administrator\Desktop\Test\lib-local

uri from json file:

"local-lib": {
            "uri": "C:\\Users\\Administrator\\Test\\lib-local"
        }

I know that url.parse it shouldn't be used on local paths as is described above, but this behavior it only can be reproduced using nodejs 11.xx (%5C), using node 10.xx it works just fine, as expected (c:\Users\Administrator\Desktop\Test\lib-local).

I've tested this under Windows 7 & 8, with the same behavior.

Just wanted to give you the heads-up about this inconsistency, I can manage the returned value without url.parse, but I repeat this is an strange behavior.

Thanks,
Martin Gonzalez
Reply all
Reply to author
Forward
0 new messages