Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix invalid path concatenation when url has a segment #574

Merged
merged 1 commit into from
Jan 22, 2025

Conversation

moleus
Copy link
Contributor

@moleus moleus commented Jan 22, 2025

Description

If the URL ends with a # symbol (e.g., https://my-jenkins.com/job/job-name/job/branch/123/pipeline-graph/#), the application mistakenly sends requests to a nested path, resulting in repeated requests to:

https://my-jenkins.com/job/job-name/job/branch/123/pipeline-graph/pipeline-graph/tree

These requests are triggered every 3 seconds and result 404 errors.

I was able to reproduce this issue in Safari browser, which adds /# in the end of the url after login redirect.

Steps to Reproduce:

  1. Open a Jenkins job URL such as:
https://my-jenkins.com/job/job-name/job/branch/123/pipeline-graph/#
  1. Now /tree requests are sent to pipeline-graph/pipeline-graph/tree.

How to reproduce in Safari with auth redirect:

  1. Click logout in Jenkins
  2. Open a Jenkins job URL https://my-jenkins.com/job/job-name/job/branch/123/pipeline-graph
  3. Under the hood, the browser performs OAuth redirects (e.g., to Google and back)
  4. When Jenkins opens, the URL ends with a /#
  5. Lots of 404 in Network tab and empty graph screen

Solution

Use URL.pathname instead of href to get path without query parameters and segments. I have fixed in getTreePath and other places.

Testing done

image

Submitter checklist

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests - that demonstrates feature works or fixes the issue

@moleus moleus requested a review from a team as a code owner January 22, 2025 07:33
Copy link
Member

@timja timja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@timja timja added the bug Something isn't working label Jan 22, 2025
@timja timja merged commit a9d1082 into jenkinsci:main Jan 22, 2025
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants