correctly handle paths with query parameters