Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting URI malformed when trying to edit record with percentage (%) symbol in. #10158

Closed
vforvaios opened this issue Aug 26, 2024 · 4 comments · Fixed by #10293
Closed

Getting URI malformed when trying to edit record with percentage (%) symbol in. #10158

vforvaios opened this issue Aug 26, 2024 · 4 comments · Fixed by #10293
Assignees

Comments

@vforvaios
Copy link

vforvaios commented Aug 26, 2024

Hi everyone,

Using react-admin (tried both 4.16.0 and 5.1.2 version).

I have a form that tries to save a form with 2 fields: name and profession using simple TextInputs.

When I pass the following data (name: 'Test' and profession: 'Surgeon%'), the backend creates a record with the following id: Test__Surgeon%

When trying to access the edit page it goes to http://localhost/......../Test__Surgeon%25 (which is the auto encoded by the react-admin) and it says "Error: URI malformed."

What exactly is the issue here?

Thanks in advance.

p.s.
I've the line that crashes in useEditController: const id = propsId ?? decodeURIComponent(routeId!);
but when I use a plain editor playground I get no error:

image

@fzaninotto fzaninotto added the bug label Aug 26, 2024
@fzaninotto
Copy link
Member

I managed to reproduce the problem in this Stackblitz: https://stackblitz.com/edit/github-ifstjz (click on the first post in the list to trigger the error-.

This is probably a bug in react-admin, marking it as such.

@fzaninotto
Copy link
Member

May be caused by a recent update in react-router (6.22), see remix-run/react-router#11199

@vforvaios
Copy link
Author

Thank you very much for your quick response. Maybe, one solution is for the backend to not create ids based on concatenation of fields, but base64 unique ids with no special characters inside.

@fzaninotto
Copy link
Member

yes, that's a good idea! But there still seems to be a double encoding issue on the react-admin side that we must fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants
@fzaninotto @djhi @vforvaios and others