Skip to content

Commit a81a906

Browse files
committed
Fixed unremoved from parent when calling 'delete' on a VirtualStoredFile
1 parent 5e5236c commit a81a906

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

lib/resource/virtualStored/VirtualStoredFile.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,13 @@ var VirtualStoredFile = (function (_super) {
3535
});
3636
};
3737
VirtualStoredFile.prototype.delete = function (callback) {
38-
this.fsManager.contentManager.deallocate(this.contentUid, callback);
38+
var _this = this;
39+
this.fsManager.contentManager.deallocate(this.contentUid, function (e) {
40+
if (e)
41+
callback(e);
42+
else
43+
_this.removeFromParent(callback);
44+
});
3945
};
4046
VirtualStoredFile.prototype.type = function (callback) {
4147
callback(null, IResource_1.ResourceType.File);

src/resource/virtualStored/VirtualStoredFile.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,12 @@ export class VirtualStoredFile extends VirtualStoredResource
3434
}
3535
delete(callback : SimpleCallback)
3636
{
37-
(this.fsManager as VirtualStoredFSManager).contentManager.deallocate(this.contentUid, callback);
37+
(this.fsManager as VirtualStoredFSManager).contentManager.deallocate(this.contentUid, (e) => {
38+
if(e)
39+
callback(e);
40+
else
41+
this.removeFromParent(callback);
42+
});
3843
}
3944

4045
// ****************************** Std meta-data ****************************** //

0 commit comments

Comments
 (0)