git.shiar.nl
/
sheet.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
f12be29
)
source: cache file names without package include paths
author
Mischa POSLAWSKY
<perl@shiar.org>
Sun, 29 Oct 2023 00:39:42 +0000
(
02:39
+0200)
committer
Mischa POSLAWSKY
<perl@shiar.org>
Sun, 29 Oct 2023 01:42:08 +0000
(
02:42
+0100)
source.plp
patch
|
blob
|
history
diff --git
a/source.plp
b/source.plp
index d7d7cb50da39a02247be400b341b7b63ae770bee..b586dbe2b028d439a5ee069b2520cc41c04e3e15 100644
(file)
--- a/
source.plp
+++ b/
source.plp
@@
-65,6
+65,7
@@
else {
say "<h1>Source of $href</h1>";
};
say "<h1>Source of $href</h1>";
};
+ my $path = $source;
if ($source =~ m{(?:/|^)\.}) {
Abort("File request not permitted", '403 source not allowed');
}
if ($source =~ m{(?:/|^)\.}) {
Abort("File request not permitted", '403 source not allowed');
}
@@
-72,15
+73,15
@@
else {
$source .= '.pm';
for (0 .. $#INC) {
-e ($_ = "$INC[$_]/$source") or next;
$source .= '.pm';
for (0 .. $#INC) {
-e ($_ = "$INC[$_]/$source") or next;
- $
source
= $_;
+ $
path
= $_;
last;
}
}
last;
}
}
- -r $
source
or Abort("Requested file not found", '404 source not found');
- my $size = (stat $
source
)->[7];
+ -r $
path
or Abort("Requested file not found", '404 source not found');
+ my $size = (stat $
path
)->[7];
my $cachefile = "source/$source.html";
my $cachefile = "source/$source.html";
- if (-e $cachefile and (stat $cachefile)->[9] >= (stat $
source
)->[9]) {
+ if (-e $cachefile and (stat $cachefile)->[9] >= (stat $
path
)->[9]) {
say '<pre>';
print ReadFile($cachefile);
say '</pre>';
say '<pre>';
print ReadFile($cachefile);
say '</pre>';
@@
-97,7
+98,7
@@
else {
or die 'early versions are buggy under FastCGI';
delete $Text::VimColor::SYNTAX_TYPE{Underlined};
return Text::VimColor->new(
or die 'early versions are buggy under FastCGI';
delete $Text::VimColor::SYNTAX_TYPE{Underlined};
return Text::VimColor->new(
- file => $
source
,
+ file => $
path
,
vim_options => [@Text::VimColor::VIM_OPTIONS, '+:set enc=utf-8'],
)->marked;
}) {
vim_options => [@Text::VimColor::VIM_OPTIONS, '+:set enc=utf-8'],
)->marked;
}) {
@@
-133,7
+134,7
@@
else {
}
else {
say '<pre>';
}
else {
say '<pre>';
- print EscapeHTML(decode_utf8(ReadFile($
source
)));
+ print EscapeHTML(decode_utf8(ReadFile($
path
)));
say '</pre>';
}
say '</pre>';
}