Skip to content

Commit 0db1014

Browse files
authored
Merge pull request #18 from JohnMcLear/master
use await
2 parents fa27d98 + 45d5ae4 commit 0db1014

File tree

5 files changed

+294
-299
lines changed

5 files changed

+294
-299
lines changed

.ep_initialized

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
done

fileview.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ var mime = require('mime');
2828
exports.expressCreateFileViewServer = function(hook_name, args, cb) {
2929

3030
args.app.get('/v/*', function(req, res) {
31-
// file path slice
31+
// file path slice
3232
var fps = req.url.slice(3, 250);
3333

3434
// TODO remove GET params
3535

36-
// file path urlencoded
36+
// file path urlencoded
3737
var fpu = encodeURIComponent(fps);
3838
// file path read url
3939
var fpr = '/v/' + fpu;
@@ -44,10 +44,10 @@ exports.expressCreateFileViewServer = function(hook_name, args, cb) {
4444
try {
4545
fs.exists(path, function(exists) {
4646
if (exists) {
47-
if (!ext.getBrush(path) && mime.getType(path) !== 'application/octet-stream') {
47+
if (!ext.getBrush(path) && mime.lookup(path) !== 'application/octet-stream') {
4848
fs.readFile(path, function(err, data) {
4949
if (err) throw err;
50-
res.set('Content-Type', mime.getType(path));
50+
res.set('Content-Type', mime.lookup(path) || ".txt");
5151
res.send(data);
5252
});
5353

0 commit comments

Comments
 (0)