Page MenuHomeSoftware Heritage

Prevent repository normalization from crashing on malformed input.

Authored by vlorentz on Jan 15 2019, 3:57 PM.

Diff Detail

rDCIDX Object indexer
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

vlorentz created this revision.Jan 15 2019, 3:57 PM
ardumont accepted this revision.Jan 15 2019, 4:57 PM
This revision is now accepted and ready to land.Jan 15 2019, 4:57 PM
douardda added inline comments.

I find this code a bit bloated.

Is it possible to have something other than a str or None for these values? (url, group and artifact) ?

Isn't this code enough?

if 'url' not in repo or repo.get('layout', 'default') != 'default':
group_id = d.get('groupId', '')
artifact_id = d.get('artifactId', '')
url = os.path.join(repo['url'], group_id.replace('.', '/'), artifact_id)
return {'@id': url}

Hard to tell since it seems this method has no unit test ๐Ÿ˜ˆ

vlorentz updated this revision to Diff 3022.Jan 15 2019, 5:02 PM
  • rebase
This revision was automatically updated to reflect the committed changes.