Skip to content

Commit

Permalink
Fixed a bug when serializing a VirtualStoredFile having a content len…
Browse files Browse the repository at this point in the history
…gth of 0
  • Loading branch information
AdrienCastex committed Jun 6, 2017
1 parent 395e060 commit c81190d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
6 changes: 3 additions & 3 deletions lib/manager/VirtualStoredFSManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,10 @@ var VirtualStoredFSManager = (function () {
properties: resource.properties
};
result.name = resource.name;
if (resource.len)
if (resource.contentUid) {
result.len = resource.len;
if (resource.contentUid)
result.contentUid = resource.contentUid;
}
return result;
};
VirtualStoredFSManager.prototype.unserialize = function (data, obj) {
Expand All @@ -146,7 +146,7 @@ var VirtualStoredFSManager = (function () {
}
if (obj.type.isFile) {
var rs = new VirtualStoredFile_1.VirtualStoredFile(data.name, null, this);
rs.len = data.len;
rs.len = data.len === undefined ? 0 : data.len;
rs.contentUid = data.contentUid;
rs.dateCreation = data.dateCreation;
rs.dateLastModified = data.dateLastModified;
Expand Down
7 changes: 4 additions & 3 deletions src/manager/VirtualStoredFSManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,11 @@ export class VirtualStoredFSManager implements FSManager
};

result.name = resource.name;
if(resource.len)
result.len = resource.len;
if(resource.contentUid)
{
result.len = resource.len;
result.contentUid = resource.contentUid;
}

return result;
}
Expand All @@ -203,7 +204,7 @@ export class VirtualStoredFSManager implements FSManager
if(obj.type.isFile)
{
const rs = new VirtualStoredFile(data.name, null, this);
rs.len = data.len;
rs.len = data.len === undefined ? 0 : data.len;
rs.contentUid = data.contentUid;
rs.dateCreation = data.dateCreation;
rs.dateLastModified = data.dateLastModified;
Expand Down

0 comments on commit c81190d

Please sign in to comment.