Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[WebProfilerBundle] Fix intercept external redirects#52584

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

@HeahDude
Copy link
Contributor

QA
Branch?6.3
Bug fix?yes
New feature?no
Deprecations?no
Issues~
LicenseMIT

When intercepting a redirect to an external host the current output gives:

This request redirects tohttp://current-host.orghttp://target-host.org/

With this PR, it fixes it too:

This request redirects tohttp://target-host.org/

We could eventually get rid of the first part of the condition, WDYT?

@smnandre
Copy link
Member

Maybe we could do this computation in the Controller directly ?

Currently the code look like this (just formatted for clarity)

WebProfilerBundle/EventListener/WebDebugToolbarListener.php

$content =$this->twig->render('@WebProfiler/Profiler/toolbar_redirect.html.twig', ['location' =>$response->headers->get('Location'),'host' =>$request->getSchemeAndHttpHost()]);$response->setContent($content);$response->setStatusCode(200);$response->headers->remove('Location');

Something like this could do the job WDYT ?

$content =$this->twig->render('@WebProfiler/Profiler/toolbar_redirect.html.twig', ['location' =>$location =$response->headers->get('Location'),'absolute_location' => (newUrlHelper($requestStack))->getAbsoluteUrl($location),]);$response->setContent($content);$response->setStatusCode(200);$response->headers->remove('Location');

And that'd allow to keep in one place all those 'Location' manipulation / transformations.

Because, even with the best intentions, i'm not sure the template code would be ever "obvious" (e g :host in the template is in fact "scheme + host" but notapp.request.host )

WDYT ?

@nicolas-grekas
Copy link
Member

I agree with@smnandre's proposal, the template can't contain this logic.

@HeahDudeHeahDudeforce-pushed thefix/intercept-external-redirects branch 3 times, most recently from16a73a6 toce01d74CompareDecember 9, 2023 16:42
@fabpotfabpotforce-pushed thefix/intercept-external-redirects branch fromce01d74 to4ffadecCompareDecember 9, 2023 17:13
@fabpot
Copy link
Member

Thank you@HeahDude.

@fabpotfabpot merged commitc481dba intosymfony:6.3Dec 9, 2023
@HeahDudeHeahDude deleted the fix/intercept-external-redirects branchDecember 9, 2023 17:16
This was referencedDec 30, 2023
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@fabpotfabpotfabpot approved these changes

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

@chalasrchalasrchalasr approved these changes

+1 more reviewer

@smnandresmnandresmnandre left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

6.3

Development

Successfully merging this pull request may close these issues.

6 participants

@HeahDude@smnandre@nicolas-grekas@fabpot@chalasr@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp