fun_with_flags_ui icon indicating copy to clipboard operation
fun_with_flags_ui copied to clipboard

Support for slash in group name

Open bmteller opened this issue 2 years ago • 3 comments

Encode slash as %2F. If group name contained a / character then this would be interpreted by phoenix router as a different path segment. I'm not sure if this works across all browsers or network setups because maybe some browsers will unescape values in the path before submitting the path or middle boxes might rewrite the path to an unescaped form.

I'm also not sure what other characters would cause the functionality to break.

Alternatively, the UI should ban you from creating flags with characters it does not support. However, I'm not sure that this is realistic because the non-ui part of the project does not put any restriction on the characters that can be contained in a name.

bmteller avatar Sep 13 '23 14:09 bmteller

Thank you for using the package and the PR.

I'm not sure I can accept this, as I'd like to keep this part of the package simple. I'm just afraid that once I start allowing for these exceptions, it becomes a slippery slope.

For reference, I documented this sort of limitation in the readme: https://github.com/tompave/fun_with_flags_ui#caveats

Why do you want to use / in group names?

tompave avatar Sep 14 '23 08:09 tompave

in that case do you think it makes sense to update def validate in utils.ex to reject the / character like it already rejects the ? character for group names. these characters are already blocked from the flag name but not the group name. https://github.com/tompave/fun_with_flags_ui/blob/master/lib/fun_with_flags/ui/utils.ex#L161

bmteller avatar Sep 14 '23 09:09 bmteller

Yes, that would make sense. I'd be happy to accept a PR for that.

tompave avatar Sep 14 '23 11:09 tompave