]> git.xolatile.top Git - gorillanest.git/commitdiff
It Works Locally So It'll Work On Server <- Some Retard Writing Perl
authorEmil Williams <emilemilemil@cock.li>
Tue, 19 Aug 2025 16:55:46 +0000 (16:55 +0000)
committerEmil Williams <emilemilemil@cock.li>
Tue, 19 Aug 2025 16:55:46 +0000 (16:55 +0000)
gorillanest

index 2d26d7f56939a7855cf2380333e3ef1dad4bcb29..b36106812c73ec3f9138d178a3100b10bc443a96 100755 (executable)
@@ -10,6 +10,7 @@ use Syntax::Keyword::Try;
 use Sys::Syslog;
 use Template;
 use URI::Escape;
+use Cwd;
 
 use Data::Dumper;
 sub info {
@@ -54,7 +55,11 @@ sub GN::user { # /$username/
 sub GN::repository { # /$username/$repository
     my ($root, $dataref) = @_;
     my %data = %$dataref;
-    $data{log} = Dumper(split(/\n/, qx(cd $root/$data{username}/$data{repository} && git log --pretty=format:\'%H | %an | %ad | %s%x0a\'))); # It technically works # | tac | tr -s \'\n\'
+    my $d = getcwd();
+    chdir(join('/', $root, $data{username}, $data{repository}));
+    warn 'sneed ' . getcwd() . "\n";
+    $data{log} = Dumper(split(/\n/, qx(git log --pretty=format:\'%H | %an | %ad | %s%x0a\'))); # It technically works # | tac | tr -s \'\n\'
+    chdir($d);
     $data{found} = 1;
     return \%data;
 }
@@ -77,11 +82,11 @@ try {
             -charset      => 'UTF-8',
             );
         my $method = $ENV{'REQUEST_METHOD'} || '';
-        my $uri = $ENV{'REQUEST_URI'} // '/';
+        my $uri = $ENV{'REQUEST_URI'} || '/';
         if ($method eq 'HEAD') {
             $head = 1;
         } elsif ($method eq 'GET') {
-            ($data{username}, $data{repository}) = $uri =~ m{^/([a-zA-Z0-9_]+)(?:/([a-zA-Z0-9_\.]+))?$}; # [[:alnum:]] didn't work
+            ($data{username}, $data{repository}) = $uri =~ m{^/([a-zA-Z0-9_.]+)(?:/([a-zA-Z0-9_.]+))?};
             info("name:", $data{username} || '', "repo:", $data{repository} || '');
             if ($uri eq '/') {
                 %data = %{GN::index($public, \%data)};