Skip to content

Commit 2382b1f

Browse files
committed
Merge branch 'master' into jquery-ui
2 parents 5d1a2ed + fc93f79 commit 2382b1f

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

server/node/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "blueimp-file-upload-node",
3-
"version": "1.0.1",
3+
"version": "1.0.2",
44
"title": "jQuery File Upload Node.js example",
55
"description": "Node.js implementation example of a file upload handler for jQuery File Upload.",
66
"keywords": [

server/node/server.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env node
22
/*
3-
* jQuery File Upload Plugin Node.js Example 1.0.1
3+
* jQuery File Upload Plugin Node.js Example 1.0.2
44
* https://github.com/blueimp/jQuery-File-Upload
55
*
66
* Copyright 2012, Sebastian Tschan
@@ -10,14 +10,15 @@
1010
* http://www.opensource.org/licenses/MIT
1111
*/
1212

13-
/*jslint nomen: true, regexp: true */
13+
/*jslint nomen: true, regexp: true, unparam: true */
1414
/*global require, __dirname, unescape */
1515

1616
(function (port) {
1717
'use strict';
18-
var util = require('util'),
19-
path = require('path'),
18+
var path = require('path'),
2019
fs = require('fs'),
20+
// Since Node 0.8, .existsSync() moved from path to fs:
21+
_existsSync = fs.existsSync || path.existsSync,
2122
formidable = require('formidable'),
2223
nodeStatic = require('node-static'),
2324
imageMagick = require('imagemagick'),
@@ -163,7 +164,7 @@
163164
// Prevent directory traversal and creating hidden system files:
164165
this.name = path.basename(this.name).replace(/^\.+/, '');
165166
// Prevent overwriting existing files:
166-
while (path.existsSync(options.uploadDir + '/' + this.name)) {
167+
while (_existsSync(options.uploadDir + '/' + this.name)) {
167168
this.name = this.name.replace(nameCountRegexp, nameCountFunc);
168169
}
169170
};
@@ -174,7 +175,7 @@
174175
'//' + req.headers.host + options.uploadUrl;
175176
this.url = this.delete_url = baseUrl + encodeURIComponent(this.name);
176177
Object.keys(options.imageVersions).forEach(function (version) {
177-
if (path.existsSync(
178+
if (_existsSync(
178179
options.uploadDir + '/' + version + '/' + that.name
179180
)) {
180181
that[version + '_url'] = baseUrl + version + '/' +
@@ -281,4 +282,4 @@
281282
} else {
282283
require('http').createServer(serve).listen(port);
283284
}
284-
}(8080));
285+
}(8888));

0 commit comments

Comments
 (0)