mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-05-30 18:32:34 +02:00
Use path.resolve instead of path.join in order to normalize the path.
This commit is contained in:
parent
35cfd9b257
commit
8a0d501ffc
1 changed files with 8 additions and 2 deletions
|
@ -216,7 +216,7 @@ class SetupDatabase {
|
||||||
const base64Data = dbConfig.caFile.replace(/^data:application\/octet-stream;base64,/, "");
|
const base64Data = dbConfig.caFile.replace(/^data:application\/octet-stream;base64,/, "");
|
||||||
const binaryData = Buffer.from(base64Data, "base64").toString("binary");
|
const binaryData = Buffer.from(base64Data, "base64").toString("binary");
|
||||||
const tempCaDirectory = fs.mkdtempSync("kuma-ca-");
|
const tempCaDirectory = fs.mkdtempSync("kuma-ca-");
|
||||||
dbConfig.caFilePath = path.join(tempCaDirectory, "ca.pem");
|
dbConfig.caFilePath = path.resolve(tempCaDirectory, "ca.pem");
|
||||||
try {
|
try {
|
||||||
fs.writeFileSync(dbConfig.caFilePath, binaryData, "binary");
|
fs.writeFileSync(dbConfig.caFilePath, binaryData, "binary");
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
@ -255,7 +255,13 @@ class SetupDatabase {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write db-config.json
|
// Write db-config.json
|
||||||
Database.writeDBConfig(dbConfig);
|
try {
|
||||||
|
Database.writeDBConfig(dbConfig);
|
||||||
|
} catch (e) {
|
||||||
|
response.status(400).json("Cannot write db-config.json: " + e.message);
|
||||||
|
this.runningSetup = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
response.json({
|
response.json({
|
||||||
ok: true,
|
ok: true,
|
||||||
|
|
Loading…
Add table
Reference in a new issue