Page MenuHomeSoftware Heritage

browse/origin-search: Ensure to encode origin URL argument in XHR calls
ClosedPublic

Authored by anlambert on Nov 8 2022, 11:49 AM.

Details

Summary

In the origins search Web UI, XHRs are sent client side to get the visit
type and status for each found origin. However origin URLs used as Web
API URL arguments were not encoded which could result in request errors
when an origin URL contain a '?' character for instance.

So ensure to encode those origin URLs used as Web API URL arguments.

Depends on D8819

Diff Detail

Repository
rDWAPPS Web applications
Branch
master
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 32740
Build 51296: Phabricator diff pipeline on jenkinsJenkins console · Jenkins
Build 51295: arc lint + arc unit

Event Timeline

Build is green

Patch application report for D8820 (id=31799)

Could not rebase; Attempt merge onto d507af4e04...

Updating d507af4e..4cc9676a
Fast-forward
 cypress/e2e/origin-search.cy.js                  | 26 +++++++++++++++++++++++-
 swh/web/browse/assets/browse/origin-search.js    |  6 +++---
 swh/web/save_origin_webhooks/generic_receiver.py |  2 +-
 swh/web/tests/data.py                            |  9 ++++++++
 4 files changed, 38 insertions(+), 5 deletions(-)
Changes applied before test
commit 4cc9676a54cc368394c05b7f19c92ea072f8041e
Author: Antoine Lambert <anlambert@softwareheritage.org>
Date:   Tue Nov 8 11:41:47 2022 +0100

    browse/origin-search: Ensure to encode origin URL argument in XHR calls
    
    In the origins search Web UI, XHRs are sent client side to get the visit
    type and status for each found origin. However origin URLs used as Web
    API URL arguments were not encoded which could result in request errors
    when an origin URL contain a '?' character for instance.
    
    So ensure to encode those origin URLs used as Web API URL arguments.

commit d7ac190db7086212dcdde8445df2be717a54e1b9
Author: Antoine Lambert <anlambert@softwareheritage.org>
Date:   Tue Nov 8 11:02:31 2022 +0100

    save_origin_webhooks: Fix tests when building debian buster package
    
    Content type sent by django test client on debian buster is equal to
    'application/json; charset=None' so tests were failing.

See https://jenkins.softwareheritage.org/job/DWAPPS/job/tests-on-diff/2123/ for more details.

This revision is now accepted and ready to land.Nov 8 2022, 2:14 PM