diff options
-rwxr-xr-x | gitweb/gitweb.perl | 2 | ||||
-rwxr-xr-x | t/t9500-gitweb-standalone-no-errors.sh | 8 |
2 files changed, 9 insertions, 1 deletions
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl index ebf2d1cf2c..1b83a8d0a0 100755 --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@ -2644,7 +2644,7 @@ sub git_get_project_ctags { close $ct; (my $ctag = $tagfile) =~ s#.*/##; - if ($val =~ /\d+/) { + if ($val =~ /^\d+$/) { $ctags->{$ctag} = $val; } else { $ctags->{$ctag} = 1; diff --git a/t/t9500-gitweb-standalone-no-errors.sh b/t/t9500-gitweb-standalone-no-errors.sh index f5648a6694..53297156a3 100755 --- a/t/t9500-gitweb-standalone-no-errors.sh +++ b/t/t9500-gitweb-standalone-no-errors.sh @@ -644,6 +644,14 @@ test_expect_success \ 'ctags: search projects by non existent tag' \ 'gitweb_run "by_tag=non-existent"' +test_expect_success \ + 'ctags: malformed tag weights' \ + 'mkdir -p .git/ctags && + echo "not-a-number" > .git/ctags/nan && + echo "not-a-number-2" > .git/ctags/nan2 && + echo "0.1" >.git/ctags/floating-point && + gitweb_run' + # ---------------------------------------------------------------------- # categories |