threads / patch / 5604

patchgitweb: Require project for all actions except few

Subject: [PATCH] gitweb: Require project for all actions except few

## tl;dr

2 messages between Sep 19, 2006 and Sep 19, 2006. Diffs are folded; open one to read it.

replies: 1people: 2as markdown or json

Jakub Narebski· Sep 19, 2006, 12:38 UTC · lore

Require that project (repository) is given for all actions except project_list, project_index and opml.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
 gitweb/gitweb.perl |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
Show changes to gitweb/gitweb.perl +4 −0
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 034cdf1..34311ee 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -341,6 +341,10 @@ if (defined $project) {
 if (!defined($actions{$action})) {
 	die_error(undef, "Unknown action");
 }
+if ($action !~ m/^opml|project_list|project_index$/ &&
+    !$project) {
+	die_error(undef, "Project needed");
+}
 $actions{$action}->();
 exit;
 
-- 
1.4.2.1
Matthias Lederhofer· Sep 19, 2006, 13:21 UTC · re: Jakub Narebski · lore

Re: [PATCH] gitweb: Require project for all actions except few

Jakub Narebski <jnareb@gmail.com> wrote:
> +if ($action !~ m/^opml|project_list|project_index$/ &&

The regexp should be: m/^(opml|project_list|project_index)$/ &&

% (echo opml_foo; echo foo_project_list_bar; echo bar_project_index) |
    perl -ne 'print if m/^opml|project_list|project_index$/;' 
opml_foo
foo_project_list_bar
bar_project_index

← back to recent threads