gitweb: Simplify snapshot format detection logic in evaluate_path_info
[gitweb.git] / gitweb / gitweb.perl
index 097bd18be5de0b52eed7c879e6bdfb3968143712..c72ae10ef140c78b3a200fca3351e2753e632421 100755 (executable)
@@ -690,9 +690,10 @@ sub evaluate_path_info {
                # format key itself, with a prepended dot
                while (my ($fmt, $opt) = each %known_snapshot_formats) {
                        my $hash = $refname;
-                       my $sfx;
-                       $hash =~ s/(\Q$opt->{'suffix'}\E|\Q.$fmt\E)$//;
-                       next unless $sfx = $1;
+                       unless ($hash =~ s/(\Q$opt->{'suffix'}\E|\Q.$fmt\E)$//) {
+                               next;
+                       }
+                       my $sfx = $1;
                        # a valid suffix was found, so set the snapshot format
                        # and reset the hash parameter
                        $input_params{'snapshot_format'} = $fmt;