2 # (c) Petr Baudis <pasky@suse.cz>
16 $cgi->charset('UTF-8');
18 my $pname = to_utf8
($cgi->param('p'), 1);
19 my $ctags = to_utf8
($cgi->param('t'), 1);
20 defined $pname or $pname = '';
21 defined $ctags or $ctags = '';
24 if ($cgi->request_method ne 'POST' || $pname eq '') {
25 print $cgi->header(-status
=>403);
26 print "<p>Invalid data. Go away, sorcerer.</p>\n";
30 my $proj = Girocco
::Project
::does_exist
($pname, 1) && Girocco
::Project
->load($pname);
32 print $cgi->header(-status
=>404);
33 print "<p>Project \"".html_esc
($pname)."\" does not exist.</p>";
37 if ($ctags =~ /[^ a-zA-Z0-9:.+#_-]/) {
38 print $cgi->header(-status
=>403);
39 print "<p>Content tag(s) '".html_esc
($ctags)."' contain evil characters.</p>";
43 my $oldmask = umask();
44 umask($oldmask & ~0060);
46 foreach my $ctag (split(/ /, $ctags)) {
47 $changed = 1 if $proj->add_ctag($ctag, 1);
51 $proj->_set_forkchange;
55 print $cgi->header(-status
=>303, -location
=>"@{[url_path($Girocco::Config::gitweburl)]}/$pname.git");