Skip to content

Commit

Permalink
Ensure that to_dict works with not-set values #787
Browse files Browse the repository at this point in the history
 * this can happen if info scan failed somehow

Signed-off-by: Philippe Ombredanne <[email protected]>
  • Loading branch information
pombredanne authored and JonoYang committed Feb 1, 2018
1 parent 1da8313 commit 38f6e4d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/scancode/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -851,9 +851,9 @@ def to_dict(self, full_root=False, strip_root=False,
absolute=full_root, strip_root=strip_root, decode=True, posix=True))
if with_info:
res['type'] = self.type
res['name'] = fsdecode(self.name)
res['base_name'] = fsdecode(self.base_name)
res['extension'] = self.extension and fsdecode(self.extension)
res['name'] = self.name and fsdecode(self.name) or ''
res['base_name'] = self.base_name and fsdecode(self.base_name) or ''
res['extension'] = self.extension and fsdecode(self.extension) or ''
res['date'] = self.date
res['size'] = self.size
res['sha1'] = self.sha1
Expand Down

0 comments on commit 38f6e4d

Please sign in to comment.