Fix and add test for isSecurePath function