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

11716 - Fix usage of resolve(reverse()) to check if FORCE_SCRIPT_NAME… #11717

Merged
merged 3 commits into from
Jan 17, 2025

Conversation

bferguso
Copy link
Contributor

@bferguso bferguso commented Jan 7, 2025

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Description of Change

The resolve(reverse(<view name)) pattern doesn't work if the FORCE_SCRIPT_NAME is setting is used when hosting behind a reverse proxy in a sub-path. This checks to see if the FORCE_SCRIPT_NAME is used to and removes the prefix to correct the issue.

Issues Solved

Closes #11716

Checklist

  • I targeted one of these branches:
    • dev/8.0.x (under development): features, bugfixes not covered below
    • dev/7.6.x (main support): regressions, crashing bugs, security issues, major bugs in new features
    • dev/6.2.x (extended support): major security issues, data loss issues
  • I added a changelog in arches/releases
  • I submitted a PR to arches-docs (if appropriate)
  • Unit tests pass locally with my changes
  • I added tests that prove my fix is effective or that my feature works
  • My test fails on the target branch

Accessibility Checklist

Developer Guide

Topic Changed Retested
Color contrast
Form fields
Headings
Links
Keyboard
Responsive Design
HTML validation
Screen reader

Ticket Background

Further comments

Copy link
Member

@jacobtylerwalls jacobtylerwalls left a comment

Choose a reason for hiding this comment

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

Ah ah I get it now -- you're saying all we need to do is undo the call to get_script_prefix() inside reverse(), and we're in the same thread. Sorry for being slow on the uptake.

PR looks good!

@jacobtylerwalls jacobtylerwalls force-pushed the 11716_fix_resolve_reverse branch 2 times, most recently from 172c649 to 7da4191 Compare January 17, 2025 19:27
@jacobtylerwalls
Copy link
Member

Added coverage, test fails on main. The missing coverage is a code path mostly (only?) called from async paths, where we have basically zero test coverage. Would be a worthy challenge in some cases, but looking closer, this is code I think we want to improve on anyway (we have a module level function outside the request/response cycle creating a dummy request). Better to remove this code than test it.

@jacobtylerwalls jacobtylerwalls force-pushed the 11716_fix_resolve_reverse branch from 7da4191 to d687b71 Compare January 17, 2025 20:26
@jacobtylerwalls jacobtylerwalls force-pushed the 11716_fix_resolve_reverse branch from d687b71 to 00bda0c Compare January 17, 2025 20:27
@jacobtylerwalls jacobtylerwalls merged commit c352f8e into dev/7.6.x Jan 17, 2025
4 of 5 checks passed
@jacobtylerwalls jacobtylerwalls deleted the 11716_fix_resolve_reverse branch January 17, 2025 20:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

resolve(reverse()) doesn't work when using WSGI / FORCE_SCRIPT_NAME
2 participants