Page MenuHomeSoftware Heritage

common/service: Handle trailing url slashes in lookup_origin
ClosedPublic

Authored by anlambert on Feb 18 2020, 2:01 PM.

Details

Summary

It will enable to find an origin when users provide urls with or without a trailing slash.

Related to T1852
Related to T2289

Diff Detail

Repository
rDWAPPS Web applications
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

vlorentz added a subscriber: vlorentz.
vlorentz added inline comments.
swh/web/common/service.py
235

at this point, len(origins) is 3.

With either the URL missing the last character, or two slashes at the end.

This revision now requires changes to proceed.Feb 18 2020, 2:09 PM

Update: Check extra origin urls only when required

Update: Improve implementation (use endswith + if/else)

This revision is now accepted and ready to land.Feb 18 2020, 4:25 PM
This revision was landed with ongoing or failed builds.Feb 18 2020, 4:47 PM
This revision was automatically updated to reflect the committed changes.