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

Do not inject web debug toolbar on attachments#18971

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

Closed
peterrehm wants to merge4 commits intosymfony:2.7frompeterrehm:toolbar
Closed

Do not inject web debug toolbar on attachments#18971

peterrehm wants to merge4 commits intosymfony:2.7frompeterrehm:toolbar

Conversation

@peterrehm
Copy link
Contributor

QA
Branch?2.7
Bug fix?yes
New feature?no
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets#18965
LicenseMIT
Doc PR-

patrick-mcdougle, ogizanagi, and apfelbox reacted with thumbs up emoji
@javiereguiluz
Copy link
Member

👍

Status: reviewed

@xabbuh
Copy link
Member

👍

protectedfunctioninjectToolbar(Response$response,Request$request)
{
// The toolbar shall not be injected if the header enforces a download of the content
if (false !==strpos($response->headers->get('Content-Disposition'),'attachment')) {
Copy link
Member

Choose a reason for hiding this comment

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

This should be moved in the condition starting at line 96 instead

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Updated.

||$response->isRedirection()
|| ($response->headers->has('Content-Type') &&false ===strpos($response->headers->get('Content-Type'),'html'))
||'html' !==$request->getRequestFormat()
||false !==strpos($response->headers->get('Content-Disposition'),'attachment')
Copy link
Contributor

Choose a reason for hiding this comment

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

The content-disposition types are case-insensitive according tohttps://tools.ietf.org/html/rfc2183
Also this current check will also trigger forContent-Disposition: <something-else>; filename=attachment which is probably not intended.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Updated accordingly. The question is now the check, I am now checking forattachment; instead.

||$response->isRedirection()
|| ($response->headers->has('Content-Type') &&false ===strpos($response->headers->get('Content-Type'),'html'))
||'html' !==$request->getRequestFormat()
||false !==strpos(strtolower($response->headers->get('Content-Disposition')),'attachment;')

Choose a reason for hiding this comment

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

stripos instead of strpos+strtolower?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Updated

@fabpot
Copy link
Member

Thank you@peterrehm.

fabpot added a commit that referenced this pull requestJun 8, 2016
This PR was squashed before being merged into the 2.7 branch (closes#18971).Discussion----------Do not inject web debug toolbar on attachments| Q             | A| ------------- | ---| Branch?       | 2.7| Bug fix?      | yes| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets |#18965| License       | MIT| Doc PR        | -Commits-------4a7d836 Do not inject web debug toolbar on attachments
@fabpotfabpot closed thisJun 8, 2016
@peterrehmpeterrehm deleted the toolbar branchJune 8, 2016 15:18
@fabpotfabpot mentioned this pull requestJun 15, 2016
This was referencedJun 30, 2016
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

7 participants

@peterrehm@javiereguiluz@xabbuh@fabpot@nicolas-grekas@Tobion@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp