Incorrect URL when browsing Swift containers

Bug #2009724 reported by Zach Graber
30
This bug affects 6 people
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Fix Released
Medium
Jeremy Boyle

Bug Description

When browsing through OpenStack Swift containers, sometimes Horizon will incorrectly encode part of the URL/URI of an object, and thus navigate to the wrong page. This has been reproducible for me by placing an object in a container more than about 3 pseudo-folders deep. For example, the structure might look like:

(Container) --> folder1 --> folder2 --> folder3

Upon clicking on folder3 in the Container browser window in Horizon, the site will try to navigate to "containers/container/containername/testfolder1%2Ftestfolder2/testfolder3" rather than the expected "containers/container/containername/testfolder1/testfolder2/testfolder3".

It appears that at some stage in the process, the path gets HTTP URL Encoded (encodeURIComponent) too many times. Note that the unexpected character "%2F" is the encoding of "/".

This is also evident by snooping on the GET request Horizon makes to the OpenStack Swift backend (see attached screenshot); the delimiter is set as "%2F", but the path requested has a "%252F" (this is just the double encoding of "%2F" since the encoding of "%" is "%25").

I'm guessing that there might be some recursive logic somewhere that results in the end-string being encoded multiple times.

Tags: swift
Revision history for this message
Zach Graber (zegraber) wrote :
Changed in horizon:
status: New → Confirmed
importance: Undecided → Medium
Revision history for this message
Jeremy Boyle (jeremy-boyle) wrote :
Revision history for this message
Jeremy Boyle (jeremy-boyle) wrote :

Hello I was able to fix this .

Line: https://github.com/openstack/horizon/blob/master/openstack_dashboard/dashboards/project/static/dashboard/project/containers/objects.controller.js#L63

needs to be updated to:

ctrl.currentURL = ctrl.containerURL + encodeURIComponent($routeParams.folder).replace(/%2F/g, '/') +

Changed in horizon:
assignee: nobody → Jeremy Boyle (jeremy-boyle)
status: Confirmed → In Progress
Revision history for this message
Jeremy Boyle (jeremy-boyle) wrote :
Revision history for this message
Jeremy Boyle (jeremy-boyle) wrote :
Revision history for this message
Jeremy Boyle (jeremy-boyle) wrote :
Revision history for this message
Jeremy Boyle (jeremy-boyle) wrote :
Revision history for this message
Jeremy Boyle (jeremy-boyle) wrote :
Revision history for this message
Jeremy Boyle (jeremy-boyle) wrote :
Revision history for this message
Jeremy Boyle (jeremy-boyle) wrote :
Revision history for this message
Jeremy Boyle (jeremy-boyle) wrote :
Revision history for this message
Jeremy Boyle (jeremy-boyle) wrote :
Revision history for this message
Jeremy Boyle (jeremy-boyle) wrote :
Revision history for this message
Jeremy Boyle (jeremy-boyle) wrote :
Revision history for this message
Jeremy Boyle (jeremy-boyle) wrote :

@Vishal Manchanda Are you able to review the changes?

tags: added: swift
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to horizon (master)

Reviewed: https://review.opendev.org/c/openstack/horizon/+/886891
Committed: https://opendev.org/openstack/horizon/commit/4aa347fe196b7b18ff0bf5f4d4f076a6c14cf12e
Submitter: "Zuul (22348)"
Branch: master

commit 4aa347fe196b7b18ff0bf5f4d4f076a6c14cf12e
Author: jeremy-boyle <email address hidden>
Date: Sat Jun 24 16:59:11 2023 +0000

    Fixing Incorrect URL when browsing Swift containers

    This patch fixes a bug identified in the code that generates the URL for
    the Swift container object. The bug caused the forward slashes (/) in the
    folder parameter to be encoded as %2F instead of being included as '/' in the
    resulting URL.

    To resolve this issue, the code has been updated by adding a replace() method
    to replace the %2F sequences with forward slashes. The updated code ensures
    that the URL generated for the folder parameter contains the correct forward
    slash (/) representation.

    Closes-Bug: #2009724
    Signed-off-by: jeremy-boyle <email address hidden>

    Change-Id: I5837e74ddcc71cda6b4686e586dbb8b1386a9cd3

Changed in horizon:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/horizon 24.0.0

This issue was fixed in the openstack/horizon 24.0.0 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on horizon (stable/zed)

Change abandoned by "Elod Illes <email address hidden>" on branch: stable/zed
Review: https://review.opendev.org/c/openstack/horizon/+/886893
Reason: stable/zed branch of openstack/horizon is about to be deleted. To be able to do that, all open patches need to be abandoned. Please cherry pick the patch to unmaintained/zed if you want to further work on this patch.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to horizon (stable/2023.1)

Reviewed: https://review.opendev.org/c/openstack/horizon/+/886892
Committed: https://opendev.org/openstack/horizon/commit/c09e8162ce0aa60bf4da8b3b0ae41272cf291fe2
Submitter: "Zuul (22348)"
Branch: stable/2023.1

commit c09e8162ce0aa60bf4da8b3b0ae41272cf291fe2
Author: jeremy-boyle <email address hidden>
Date: Sat Jun 24 16:59:11 2023 +0000

    Fixing container view bug on lp #2009724

    Closes-Bug: #2009724
    Change-Id: I5837e74ddcc71cda6b4686e586dbb8b1386a9cd3
    Signed-off-by: jeremy-boyle <email address hidden>

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/horizon 23.1.1

This issue was fixed in the openstack/horizon 23.1.1 release.

Revision history for this message
Shyam (shyam.biradar) wrote :

Hi Team,

Looks like we missed to merge this fix in 2023.2 branch.
I don't see it in 2023.2 branch.

https://opendev.org/openstack/horizon/src/branch/stable/2023.2/openstack_dashboard/dashboards/project/static/dashboard/project/containers/objects.controller.js#L63

Can we merge this fix in 2023.2?

Thank you.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to horizon (stable/2023.2)

Fix proposed to branch: stable/2023.2
Review: https://review.opendev.org/c/openstack/horizon/+/940359

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to horizon (stable/2023.2)

Reviewed: https://review.opendev.org/c/openstack/horizon/+/940359
Committed: https://opendev.org/openstack/horizon/commit/c873490d3fe773aa7f75521cf9a66683c0c35f6f
Submitter: "Zuul (22348)"
Branch: stable/2023.2

commit c873490d3fe773aa7f75521cf9a66683c0c35f6f
Author: jeremy-boyle <email address hidden>
Date: Sat Jun 24 16:59:11 2023 +0000

    Fixing Incorrect URL when browsing Swift containers

    This patch fixes a bug identified in the code that generates the URL for
    the Swift container object. The bug caused the forward slashes (/) in the
    folder parameter to be encoded as %2F instead of being included as '/' in the
    resulting URL.

    To resolve this issue, the code has been updated by adding a replace() method
    to replace the %2F sequences with forward slashes. The updated code ensures
    that the URL generated for the folder parameter contains the correct forward
    slash (/) representation.

    Closes-Bug: #2009724
    Signed-off-by: jeremy-boyle <email address hidden>

    Change-Id: I5837e74ddcc71cda6b4686e586dbb8b1386a9cd3
    (cherry picked from commit 4aa347fe196b7b18ff0bf5f4d4f076a6c14cf12e)

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/horizon 23.3.1

This issue was fixed in the openstack/horizon 23.3.1 Bobcat release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.