bref icon indicating copy to clipboard operation
bref copied to clipboard

Colons in URIs are not supported with the function runtime

Open mnapoli opened this issue 1 year ago • 3 comments

For example /tags/john:81.

I'm opening this PR with a test case to reproduce. I don't have a fix yet.

@Nyholm the root of the exception is in https://github.com/Nyholm/psr7, specifically here:

https://github.com/Nyholm/psr7/blob/229484fc939a76a6579e331b55d86a77fb8e2863/src/Uri.php#L54-L56

This is caused by PHP not supporting these URIs in parse_url: https://3v4l.org/jpiQo

https://github.com/php/php-src/issues/12703

Any idea whether https://github.com/Nyholm/psr7 could have a workaround to support these URIs? Should I open a bug there? (do you want to address this?)

mnapoli avatar Apr 30 '24 17:04 mnapoli

Strictly speaking, this is an invalid URL. The colon should be %3A.

GrahamCampbell avatar Apr 30 '24 17:04 GrahamCampbell

Yeah. I was about to say the same as Graham. If it is a valid url, then we should support it. But if it is invalid, then an exception should be thrown.

Nyholm avatar Apr 30 '24 21:04 Nyholm

hold on good points, I actually got the report that it was happening both with and without the encoding, I should have made it clearer (and I went with the easiest repro, which may have been a mistake from me). I'll investigate and report back.

mnapoli avatar May 01 '24 08:05 mnapoli

It turns out the root of the problem is API Gateway v2: it decodes encoded paths. That means that we receive them "invalid" (uri-decoded).

API Gateway v1 and Lambda Function URLs do not do this. I'm not sure there's an easy solution here unfortunately. I want to move most of Bref's defaults to FURL eventually, so this problem should disappear at some point.

mnapoli avatar May 14 '24 12:05 mnapoli