[PATCH v3] models: Validate Project.linkname does not contain forward slash

Stephen Finucane stephen at that.guru
Fri Oct 2 01:43:56 AEST 2020


On Mon, 2020-09-28 at 18:37 +0200, Thomas Bracht Laumann Jespersen wrote:
> I started by creating a project that contained a forward slash
> (importing patches from https://lists.sr.ht/~sircmpwn/sr.ht-dev/) and
> it fails to render the "projects" main page.
> 
> The specific error reads:
> 
>     NoReverseMatch at /
> 
>     Reverse for 'patch-list' with keyword arguments
>     '{'project_id': 'foo/bar'}' not found. 1 pattern(s) tried:
>     ['project/(?P<project_id>[^/]+)/list/$']
> 
> which appears to explicitly disallow forward slashes.
> 
> So I think it makes sense to validate that project linkname doesn't
> contain forward slahes.
> 
> This implementation uses the validate_unicode_slug validator instead of just
> rejecting inputs that contain forward slashes.
> 
> Signed-off-by: Thomas Bracht Laumann Jespersen <t at laumann.xyz>

Thanks! Applied.




More information about the Patchwork mailing list