Skip to content

Commit 1b6a932

Browse files
committed
tmpname
1 parent 2c208ae commit 1b6a932

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
jquery-file-upload-middleware
22
=============================
33

4+
### Changes
5+
1. imageMagick.resize -> imageMagick.crop
6+
2. options.getList variable, don't display filelist on production
7+
3. uploaded filename change to the tmpname
8+
4. cannot delete image via this plugin
9+
410
### Personal Patch Repository
511

612
Please comeback [Aleksandr Guidrevitch](http://aguidrevitch.blogspot.com/) lol

lib/filehandler.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ module.exports = function (middleware, options) {
5151
handler.post();
5252
break;
5353
case 'DELETE':
54-
handler.destroy();
54+
// handler.destroy();
5555
break;
5656
default:
5757
res.send(405);

lib/fileinfo.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
var fs = require('fs'),
2+
path = require('path'),
23
_ = require('lodash');
34

45
module.exports = function (options) {
56

67
var FileInfo = function (file) {
7-
this.name = file.name;
8+
// this.name = file.name;
9+
this.name = path.basename(file.path) + path.extname(file.name)
810
this.originalName = file.name;
911
this.size = file.size;
1012
this.type = file.type;
@@ -24,7 +26,7 @@ module.exports = function (options) {
2426

2527
FileInfo.prototype.safeName = function () {
2628
// Prevent directory traversal and creating hidden system files:
27-
this.name = require('path').basename(this.name).replace(/^\.+/, '');
29+
this.name = path.basename(this.name).replace(/^\.+/, '');
2830
// Prevent overwriting existing files:
2931
while (fs.existsSync(options.baseDir() + '/' + this.name)) {
3032
this.name = this.name.replace(/(?:(?: \(([\d]+)\))?(\.[^.]+))?$/, function (s, index, ext) {

0 commit comments

Comments
 (0)