-
-
Notifications
You must be signed in to change notification settings - Fork 682
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added disable rename files #158
Conversation
util.inherits(IncomingForm, EventEmitter); | ||
exports.IncomingForm = IncomingForm; | ||
|
||
IncomingForm.UPLOAD_DIR = (function() { | ||
var dirs = [process.env.TMP, '/tmp', process.cwd()]; | ||
for (var i = 0; i < dirs.length; i++) { | ||
for (var i = 0, l = dirs.length; i < l; i++) { | ||
var dir = dirs[i]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
small optimization :)
A few things:
|
Explain your use case: When I upload files to the server, such as his name game.apk, after passing through IncomingForm name becomes 666a0d1b2d94b15f82b311193b694abf.apk. And when the user downloads the game on the phone, he always asks: What a strange file name? if my file is named '../../my.jpeg' and param isAutoRename=true name will be 7a7a7..aa7.jpeg I added test in test/unit/test-incoming-form.js. His name is '#_uploadPath with disable rename files (isAutoRename)' |
@@ -56,6 +56,17 @@ test('IncomingForm', { | |||
var ext = path.extname(form._uploadPath('super.bar')); | |||
assert.equal(ext, '.bar'); | |||
}, | |||
'#_uploadPath with disable rename files (isAutoRename)': function() { | |||
var fileName = "sample.txt"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for example: my.jpeg
^-- you have not done that, please add such a test. |
added test |
Kind of related to #488 (and few others if i remember correctly) which was also closed recently. We will work on some option that is about the file naming, renaming, escaping/sanitize and etc stuff. Closing this. |
request for my issue
#154
set isAutoRename = false for disable rename uploading files