File tree 1 file changed +13
-1
lines changed
1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -174,8 +174,20 @@ module.exports = function (options) {
174
174
var self = this ,
175
175
fileName = path . basename ( decodeURIComponent ( this . req . url ) ) ;
176
176
177
- fs . unlink ( options . uploadDir ( ) + '/' + fileName , function ( ex ) {
177
+ var filepath = path . join ( options . uploadDir ( ) , fileName ) ;
178
+ if ( filepath . indexOf ( options . uploadDir ( ) ) !== 0 ) {
179
+ self . emit ( 'delete' , fileName ) ;
180
+ self . callback ( { success : false } ) ;
181
+ return ;
182
+ }
183
+ fs . unlink ( filepath , function ( ex ) {
178
184
_ . 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
+ }
179
191
fs . unlink ( options . uploadDir ( ) + '/' + version + '/' + fileName ) ;
180
192
} ) ;
181
193
self . emit ( 'delete' , fileName ) ;
You can’t perform that action at this time.
0 commit comments