Skip to content

Commit

Permalink
Fixed unremoved from parent when calling 'delete' on a VirtualStoredFile
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrienCastex committed Jun 5, 2017
1 parent 5e5236c commit a81a906
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
8 changes: 7 additions & 1 deletion lib/resource/virtualStored/VirtualStoredFile.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,13 @@ var VirtualStoredFile = (function (_super) {
});
};
VirtualStoredFile.prototype.delete = function (callback) {
this.fsManager.contentManager.deallocate(this.contentUid, callback);
var _this = this;
this.fsManager.contentManager.deallocate(this.contentUid, function (e) {
if (e)
callback(e);
else
_this.removeFromParent(callback);
});
};
VirtualStoredFile.prototype.type = function (callback) {
callback(null, IResource_1.ResourceType.File);
Expand Down
7 changes: 6 additions & 1 deletion src/resource/virtualStored/VirtualStoredFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,12 @@ export class VirtualStoredFile extends VirtualStoredResource
}
delete(callback : SimpleCallback)
{
(this.fsManager as VirtualStoredFSManager).contentManager.deallocate(this.contentUid, callback);
(this.fsManager as VirtualStoredFSManager).contentManager.deallocate(this.contentUid, (e) => {
if(e)
callback(e);
else
this.removeFromParent(callback);
});
}

// ****************************** Std meta-data ****************************** //
Expand Down

0 comments on commit a81a906

Please sign in to comment.