|
|
@ -141,16 +141,13 @@ namespace Squidex.Infrastructure.Assets |
|
|
{ |
|
|
{ |
|
|
try |
|
|
try |
|
|
{ |
|
|
{ |
|
|
var filter = |
|
|
file.Delete(); |
|
|
Builders<GridFSFileInfo>.Filter.And( |
|
|
using (var cursor = await bucket.FindAsync(Builders<GridFSFileInfo>.Filter.And( |
|
|
Builders<GridFSFileInfo>.Filter.Eq(x => x.Filename, file.Name) |
|
|
Builders<GridFSFileInfo>.Filter.Eq(x => x.Filename, file.Name) |
|
|
); |
|
|
))) |
|
|
using (var cursor = await bucket.FindAsync(filter)) |
|
|
|
|
|
{ |
|
|
{ |
|
|
await cursor.ForEachAsync(fileInfo => bucket.DeleteAsync(fileInfo.Id)); |
|
|
await cursor.ForEachAsync(fileInfo => bucket.DeleteAsync(fileInfo.Id)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
file.Delete(); |
|
|
|
|
|
} |
|
|
} |
|
|
catch (FileNotFoundException ex) |
|
|
catch (FileNotFoundException ex) |
|
|
{ |
|
|
{ |
|
|
|