fixed: Handle URL vs. non-URL encoding properly for path substitution