The rights of my users are at /api/admin/users/{userId}/rights
And my controller is as simple as
[Route("/api/admin/users/{userId}/rights")]
public async Task<IActionResult> GetRights([FromRoute]string userId)
{
var rights = await _someService.GetRights(userId);
return Ok(rights);
}
or
[HttpPut("{userId}")]
public async Task<IActionResult> Update(string userId, [FromBody]UpdateUserViewModel parameters)
{
var user = await _employeService.Update(userId, parameters);
return Ok(user);
}
The problem I have is that, the userIds of my users may contains a / which is encoded to %2F in the Uri. But userId doesn't decode %2F so my string contains %2F. It's fine for me, I can deal with that.
But the userIds of my users may contains a + which is encoded to %2B in the Uri. And now, the userId decode the %2B to + 😲
Currently, I can't use WebUtility.UrlDecode(userId) because userId may contains a + which would be send as %2B decoded as + and finally to . My only actual solution is to replace %2F to / which is ugly and does not solve all the possibility : %252F
I saw a recommandation to use [FromQuery] instead of [FromRoute] but it's obvious that if both exist, it's because they have semantic difference.
It seems that's not the first time the problem appears : aspnet/Mvc#4599, #2655, #4445 and I'd like to know if it's on the roadmap to change this behavior or not.
Could you please this time consider this bug ? I'd be happy to help.
The rights of my users are at
/api/admin/users/{userId}/rightsAnd my controller is as simple as
or
The problem I have is that, the userIds of my users may contains a
/which is encoded to%2Fin the Uri. But userId doesn't decode%2Fso my string contains%2F. It's fine for me, I can deal with that.But the userIds of my users may contains a
+which is encoded to%2Bin the Uri. And now, the userId decode the%2Bto+😲Currently, I can't use
WebUtility.UrlDecode(userId)becauseuserIdmay contains a+which would be send as%2Bdecoded as+and finally to. My only actual solution is to replace%2Fto/which is ugly and does not solve all the possibility :%252FI saw a recommandation to use
[FromQuery]instead of[FromRoute]but it's obvious that if both exist, it's because they have semantic difference.It seems that's not the first time the problem appears : aspnet/Mvc#4599, #2655, #4445 and I'd like to know if it's on the roadmap to change this behavior or not.
Could you please this time consider this bug ? I'd be happy to help.