X-Git-Url: https://git.ladys.computer/Gitweb/blobdiff_plain/03a52106a0b6956b2e91ce1dcfda1ecfbf49542b3d71d8ca3fa6248e47ff8520..fd0f6cb5638966a4c5b3381a9bf08cc8fe7557ba87b420284b4cfc064b7fe5c7:/gitweb.perl diff --git a/gitweb.perl b/gitweb.perl index 7a7bf5d..a0e5de9 100755 --- a/gitweb.perl +++ b/gitweb.perl @@ -1453,6 +1453,16 @@ sub validate_pathname { return $input; } +sub is_valid_ref_format { + my $input = shift || return undef; + + # restrictions on ref name according to git-check-ref-format + if ($input =~ m!(/\.|\.\.|[\000-\040\177 ~^:?*\[]|/$)!) { + return undef; + } + return $input; +} + sub validate_refname { my $input = shift || return undef; @@ -1463,10 +1473,9 @@ sub validate_refname { # it must be correct pathname $input = validate_pathname($input) or return undef; - # restrictions on ref name according to git-check-ref-format - if ($input =~ m!(/\.|\.\.|[\000-\040\177 ~^:?*\[]|/$)!) { - return undef; - } + # check git-check-ref-format restrictions + is_valid_ref_format($input) + or return undef; return $input; }