1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2026-04-27 01:01:29 +00:00

Correct mistaken path.join vs. path.resolve

See https://stackoverflow.com/a/39836259
This commit is contained in:
Jermolene
2018-06-25 17:19:50 +01:00
parent 13f7959e63
commit 6f8711d469
2 changed files with 2 additions and 2 deletions

View File

@@ -31,7 +31,7 @@ BasicAuthenticator.prototype.init = function() {
// Read the credentials data
this.credentialsFilepath = this.server.get("credentials");
if(this.credentialsFilepath) {
var resolveCredentialsFilepath = path.join($tw.boot.wikiPath,this.credentialsFilepath);
var resolveCredentialsFilepath = path.resolve($tw.boot.wikiPath,this.credentialsFilepath);
if(fs.existsSync(resolveCredentialsFilepath) && !fs.statSync(resolveCredentialsFilepath).isDirectory()) {
var credentialsText = fs.readFileSync(resolveCredentialsFilepath,"utf8"),
credentialsData = $tw.utils.parseCsvStringWithHeader(credentialsText);

View File

@@ -20,7 +20,7 @@ exports.handler = function(request,response,state) {
var path = require("path"),
fs = require("fs"),
util = require("util");
var filename = path.join($tw.boot.wikiPath,"files",decodeURIComponent(state.params[0])),
var filename = path.resolve($tw.boot.wikiPath,"files",decodeURIComponent(state.params[0])),
extension = path.extname(filename);
fs.readFile(filename,function(err,content) {
var status,content,type = "text/plain";