mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-05-25 18:37:47 +02:00
fix image resolution
This commit is contained in:
@@ -76,11 +76,9 @@ app.get("/api/stat", async (_, res) => {
|
|||||||
|
|
||||||
function indexResponse(req, res) {
|
function indexResponse(req, res) {
|
||||||
if (req.params.repoId && req.headers["accept"] && req.headers["accept"].indexOf("text/html") == -1) {
|
if (req.params.repoId && req.headers["accept"] && req.headers["accept"].indexOf("text/html") == -1) {
|
||||||
const repoId = req.path.split("/")[1];
|
const repoId = req.path.split("/")[2];
|
||||||
req.path.substring(req.path.indexOf(repoId) + 1)
|
|
||||||
console.log(repoId, req.path.substring(req.path.indexOf(repoId) + 1))
|
|
||||||
// if it is not an html request, it assumes that the browser try to load a different type of resource
|
// if it is not an html request, it assumes that the browser try to load a different type of resource
|
||||||
return res.redirect(`/api/repo/${repoId}/file/${req.params[0]}`);
|
return res.redirect(`/api/repo/${repoId}/file/${req.path.substring(req.path.indexOf(repoId) + 1)}`);
|
||||||
}
|
}
|
||||||
res.sendFile(path.resolve(__dirname, "public", "index.html"));
|
res.sendFile(path.resolve(__dirname, "public", "index.html"));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user