Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Not needing the file-server as node static middleware is taking care …

…of that
  • Loading branch information...
commit 2a1f949c64614178cfe3b50f821ca37a96b16ad8 1 parent d54ba62
@kulor authored
View
24 server/node-express/lib/file-server.js
@@ -1,24 +0,0 @@
-var nodeStatic = require('node-static'),
- path = require('path'),
- utf8encode = function (str) {
- return unescape(encodeURIComponent(str));
- };
-
-exports.fileServer = function(options){
- var fileServer = new nodeStatic.Server(options.publicDir, options.nodeStatic);
- fileServer.respond = function (pathname, status, _headers, files, stat, req, res, finish) {
- if (!options.safeFileTypes.test(files[0])) {
- // Force a download dialog for unsafe file extensions:
- res.setHeader(
- 'Content-Disposition',
- 'attachment; filename="' + utf8encode(path.basename(files[0])) + '"'
- );
- } else {
- // Prevent Internet Explorer from MIME-sniffing the content-type:
- res.setHeader('X-Content-Type-Options', 'nosniff');
- }
- nodeStatic.Server.prototype.respond
- .call(this, pathname, status, _headers, files, stat, req, res, finish);
- };
- return fileServer;
-};
View
4 server/node-express/lib/upload-routes.js
@@ -4,8 +4,7 @@ var fs = require('fs'),
path = require('path');
var configure = function(options){
- var fileServer = require('./file-server').fileServer(options),
- FileInfo = require('./file-info').FileInfo(options),
+ var FileInfo = require('./file-info').FileInfo(options),
setNoCacheHeaders = function (res) {
res.setHeader('Pragma', 'no-cache');
res.setHeader('Cache-Control', 'no-store, no-cache, must-revalidate');
@@ -65,7 +64,6 @@ var configure = function(options){
files.push(fileInfo);
}).on('field', function (name, value) {
if (name === 'redirect') {
- console.log(value);
res.redirect(value);
}
}).on('file', function (name, file) {
Please sign in to comment.
Something went wrong with that request. Please try again.