Skip to content

Commit 17b0a5f

Browse files
committed
redundant checks removed
1 parent fa562bc commit 17b0a5f

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

lib/uploadhandler.js

+2-8
Original file line numberDiff line numberDiff line change
@@ -177,18 +177,12 @@ module.exports = function (options) {
177177
var filepath = path.join(options.uploadDir(), fileName);
178178
if (filepath.indexOf(options.uploadDir()) !== 0) {
179179
self.emit('delete', fileName);
180-
self.callback({success: false});
180+
self.callback({success: false});
181181
return;
182182
}
183183
fs.unlink(filepath, function (ex) {
184184
_.each(options.imageVersions, function (value, version) {
185-
var versionfilepath = path.join(options.uploadDir(), version, fileName);
186-
if (versionfilepath.indexOf(options.uploadDir()) !== 0) {
187-
self.emit('delete', fileName);
188-
self.callback({success: false});
189-
return;
190-
}
191-
fs.unlink(versionfilepath);
185+
fs.unlink(path.join(options.uploadDir(), version, fileName));
192186
});
193187
self.emit('delete', fileName);
194188
self.callback({success: !ex});

0 commit comments

Comments
 (0)