typescript(translucid): fixed forbbiden sendFile
Signed-off-by: prescientmoon <git@moonythm.dev>
This commit is contained in:
parent
76430ff691
commit
2f229fb449
|
@ -1,7 +1,9 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const express = require('express');
|
const express = require('express');
|
||||||
|
const path = require('path');
|
||||||
const read_1 = require("./read");
|
const read_1 = require("./read");
|
||||||
|
const dir = path.dirname(require.main.filename);
|
||||||
function containsAny(array, keys) {
|
function containsAny(array, keys) {
|
||||||
for (let i = 0; i < keys.length; i++) {
|
for (let i = 0; i < keys.length; i++) {
|
||||||
if (array.indexOf(keys[i]) != -1)
|
if (array.indexOf(keys[i]) != -1)
|
||||||
|
@ -53,7 +55,7 @@ class Translucid {
|
||||||
else
|
else
|
||||||
res.sendFile(prev);
|
res.sendFile(prev);
|
||||||
});
|
});
|
||||||
decorated[0]((!sendFiles) ? readResults : `${__dirname}/../../${filepath}`);
|
decorated[0]((!sendFiles) ? readResults : `${dir}/${filepath}`);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
const express = require('express');
|
const express = require('express');
|
||||||
|
const path = require('path');
|
||||||
import {read} from "./read";
|
import {read} from "./read";
|
||||||
|
|
||||||
|
const dir = path.dirname(require.main.filename);
|
||||||
|
|
||||||
interface Middleware{
|
interface Middleware{
|
||||||
name:string;
|
name:string;
|
||||||
keys:Array<string>;
|
keys:Array<string>;
|
||||||
|
@ -61,7 +64,7 @@ class Translucid {
|
||||||
res.sendFile(prev);
|
res.sendFile(prev);
|
||||||
});
|
});
|
||||||
|
|
||||||
decorated[0]((!sendFiles)?readResults:`${__dirname}/../../${filepath}`);
|
decorated[0]((!sendFiles)?readResults:`${dir}/${filepath}`);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue