fix: can read js in ../
parent
5433fe0522
commit
8d6864f145
|
@ -177,6 +177,7 @@ function main($path)
|
|||
if (isset($_GET['jsFile'])) {
|
||||
if (substr($_GET['jsFile'], -3)!='.js') return output('', 403);
|
||||
if (!($path==''||$path=='/')) return output('', 308, [ 'Location' => path_format($_SERVER['base_path'] . '/?jsFile=' . $_GET['jsFile']) ]);
|
||||
if (strpos($_GET['jsFile'], '/')>-1) $_GET['jsFile'] = splitlast($_GET['jsFile'], '/')[1];
|
||||
$jsFile = file_get_contents('js/' . $_GET['jsFile']);
|
||||
if (!!$jsFile) {
|
||||
return output( base64_encode($jsFile), 200, [ 'Content-Type' => 'text/javascript; charset=utf-8', 'Cache-Control' => 'max-age=' . 3*24*60*60 ], true );
|
||||
|
|
Loading…
Reference in New Issue