Page MenuHomeSoftware Heritage

SWHIDs: Fix URLs escaping when a qualifier contains escaped chars
ClosedPublic

Authored by anlambert on Sep 24 2020, 5:39 PM.

Details

Summary

When a SWHID qualifier contains special characters like '=' or ';', it
must be escaped in order for the SWHID to be properly parsed afterwards.

When using such a SWHID as part of an URL argument, it must also be escaped
for special characters in order for a browser to resolve the proper URL.

That commit fixes invalid unescaped URLs that were previously inserted in
some webapp pages (leading to 400 errors).

Closes T2641

Diff Detail

Repository
rDWAPPS Web applications
Branch
fix-swhid-with-quoted-chars-resolving-url
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 15513
Build 23894: Phabricator diff pipeline on jenkinsJenkins console · Jenkins
Build 23893: arc lint + arc unit

Unit TestsFailed

TimeTest
0 msJenkins > should display badge integration info when clicking on it::Tests / Cypress tests / Run cypress tests / Persistent Identifiers Tests should display badge integration info when clicking on it
AssertionError: Timed out retrying: Expected to find content: 'http://localhost:5004/swh:1:cnt:b2613ff021265c651e06a8ce3845bf03d033172d;origin=https://github.com/wcoder/highlightjs-line-numbers.js;visit=swh:1:snp:da8abf3ec5203afa1561754a041aca64d7580ec2;anchor=swh:1:rel:6877028d6e5412780517d0bfa81f07f6c51abb41;path=/src/highlightjs-line-numbers.js;lines=6-12/' within the element: <pre.swh-badge-html> but never did. at Context.eval (http://localhost:5004/__cypress/tests?p=cypress/integration/persistent-identifiers.spec.js:275:59)
211 msJenkins > .tox.py3.lib.python3.7.site-packages.swh.web.tests.admin.test_origin_save::Tests / Python tests / test_accept_pending_save_request
675 msJenkins > .tox.py3.lib.python3.7.site-packages.swh.web.tests.admin.test_origin_save::Tests / Python tests / test_add_authorized_origin_url
115 msJenkins > .tox.py3.lib.python3.7.site-packages.swh.web.tests.admin.test_origin_save::Tests / Python tests / test_add_unauthorized_origin_url
188 msJenkins > .tox.py3.lib.python3.7.site-packages.swh.web.tests.admin.test_origin_save::Tests / Python tests / test_reject_pending_save_request
View Full Test Results (1 Failed · 594 Passed · 7 Skipped)

Event Timeline

Build has FAILED

Patch application report for D4035 (id=14239)

Rebasing onto ef0f7ae0e7...

Current branch diff-target is up to date.
Changes applied before test
commit 8aec3d5f9cda1541b9d8e74de5c39ee0c2db55eb
Author: Antoine Lambert <antoine.lambert@inria.fr>
Date:   Thu Sep 24 12:38:01 2020 +0200

    SWHIDs: Fix URLs escaping when a qualifier contains escaped chars
    
    When a SWHID qualifier contains special characters like '=' or ';', it
    must be escaped in order for the SWHID to be properly parsed afterwards.
    
    When using such a SWHID as part of an URL argument, it must also be escaped
    for special characters in order for a browser to resolve the proper URL.
    
    That commit fixes invalid unescaped URLs that were previously inserted in
    some webapp pages (leading to 400 errors).
    
    Closes T2641

Link to build: https://jenkins.softwareheritage.org/job/DWAPPS/job/tests-on-diff/388/
See console output for more information: https://jenkins.softwareheritage.org/job/DWAPPS/job/tests-on-diff/388/console

This revision is now accepted and ready to land.Sep 24 2020, 5:49 PM

Build is green

Patch application report for D4035 (id=14244)

Rebasing onto ef0f7ae0e7...

Current branch diff-target is up to date.
Changes applied before test
commit 1d48edfb2ebaa1ad3bffbf364f54d59fb3fb2ad4
Author: Antoine Lambert <antoine.lambert@inria.fr>
Date:   Thu Sep 24 12:38:01 2020 +0200

    SWHIDs: Fix URLs escaping when a qualifier contains escaped chars
    
    When a SWHID qualifier contains special characters like '=' or ';', it
    must be escaped in order for the SWHID to be properly parsed afterwards.
    
    When using such a SWHID as part of an URL argument, it must also be escaped
    for special characters in order for a browser to resolve the proper URL.
    
    That commit fixes invalid unescaped URLs that were previously inserted in
    some webapp pages (leading to 400 errors).
    
    Closes T2641

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