mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-02-12 18:32:44 +00:00
fix: fix file path in webview
This commit is contained in:
@@ -43,7 +43,10 @@ async function webView(req: express.Request, res: express.Response) {
|
||||
|
||||
const wRoot = repo.options.pageSource.path;
|
||||
|
||||
const filePath = req.path.split(req.params.repoId)[1];
|
||||
const indexRepoId = req.path.indexOf(req.params.repoId);
|
||||
const filePath = req.path.substring(
|
||||
indexRepoId + req.params.repoId.length + 1
|
||||
);
|
||||
let requestPath = path.join(wRoot, filePath);
|
||||
if (requestPath.at(0) == "/") {
|
||||
requestPath = requestPath.substring(1);
|
||||
|
||||
Reference in New Issue
Block a user