pocketbase icon indicating copy to clipboard operation
pocketbase copied to clipboard

Unable to delete rows in collection when using "+"characters in customId

Open YoRHa-A5 opened this issue 3 years ago • 5 comments

When using special characters like + in a customId for a record one is later unable to delete the record via the API since trying to call this:

image

results in API calls like this:

image

Backend was hosted on Fly, the delete calls where submitted via the admin ui. Let me know if you need more info 🙂

YoRHa-A5 avatar Jan 09 '23 18:01 YoRHa-A5

Hm weird, apparently %2B is the escaped + sign, still it results in a 404 🤔 (Creating and deleting a new record to the collection with auto id worked btw.)

YoRHa-A5 avatar Jan 09 '23 18:01 YoRHa-A5

This is caused by the url encoded characters because internally we try to match the record id with the c.PathParam("id") value, but for some reason instead of the decoded value the raw version is returned. I'm not sure whether this is an issue with echo or if it is related to https://github.com/golang/go/issues/33596. I'll investigate it in more details and will add an integration test to verify the decoding.

ganigeorgiev avatar Jan 09 '23 19:01 ganigeorgiev

Thanks, otherwise I would suggest to simply validate url safe characters:

https://stackoverflow.com/a/695469

YoRHa-A5 avatar Jan 09 '23 19:01 YoRHa-A5

Validating just the characters is not enough since the above could happen with other user defined url parameters.

It will be fixed soon, but I'll need to first find out whether this is an issue with echo or it is just an implementation detail and we'll have to apply a fix in our code.

ganigeorgiev avatar Jan 09 '23 19:01 ganigeorgiev

This is fixed in master and will be available with the next bugfix release sometime later this week.

It turn out that it is an implementation detail of echo but it is configurable so we just had to enable the option.

ganigeorgiev avatar Jan 09 '23 20:01 ganigeorgiev