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

[Mime] handle passing custom mime types as string#36716

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
fabpot merged 1 commit intosymfony:4.4frommcneely:mimetype_fix
May 9, 2020

Conversation

@mcneely
Copy link
Contributor

QA
Branch?4.4
Bug fix?yes
New feature?no
Deprecations?no
TicketsFix#36715
LicenseMIT
Doc PRnone
Fix's issue where custom mimetypes were failing

@xabbuh
Copy link
Member

I am not sure that this qualifies as a bug fix. Reading the code it clear that the constructor expects a list of extensions not a single one. Maybe we should clarify that by adding a docblock?

Like this:

/** * @param array<string, array<int, string>> $map */publicfunction__construct(array$map = []){// ...}

@mcneely
Copy link
ContributorAuthor

@xabbuh
The bugfix is on line 56, right now it's setting the mimetype for an extension as a string and not an array. getMimeTypes is expected to return an array but when it gets the extension it's a string and throws an error.

@xabbuh
Copy link
Member

What I wanted to say is that this was probably not supposed to work:

$mt =newMimeTypes(['text/bar' =>'foo',]);

It should have been written like this instead:

$mt =newMimeTypes(['text/bar' => ['foo'],]);

@mcneely
Copy link
ContributorAuthor

What's wrong with adding that in?

@nicolas-grekasnicolas-grekas changed the titleFix for #36715[Mime] handle passing custom mime types as stringMay 6, 2020
@xabbuh
Copy link
Member

There's nothing wrong with it. I am just questioning whether this has been an intended usage. Depending on the answer this patch would either be a bugfix or a new feature.

@mcneely
Copy link
ContributorAuthor

@xabbuh I have removed the line of convenience code you're so caught up on. Now it's only a bug fix.

@mcneely
Copy link
ContributorAuthor

@nicolas-grekas I think the 7.1 integration just needs to be rerun, some sort of hiccup, probably because of 2 commits back to back.

@nicolas-grekas
Copy link
Member

nicolas-grekas commentedMay 7, 2020
edited
Loading

At least there is a bug thatif you pass a string, it explodes.
I'm fine merging as a bugfix for this reason on my side.

@xabbuh
Copy link
Member

xabbuh commentedMay 8, 2020
edited
Loading

@xabbuh I have removed the line of convenience code you're so caught up on. Now it's only a bug fix.

I think there is a misunderstanding here. My concern was not if changing that line is important, but whether or not we want to treat the whole patch as a bugfix or as a new feature. I can see good reasons for both that's why I wanted to discuss that.

I misunderstood the comment I replied to. I understand the issue now and the proposed change fixes it. 👍

foreach ($extensionsas$extension) {
$this->mimeTypes[$extension] =$mimeType;
$this->mimeTypes[$extension] =$this->mimeTypes[$extension] ?? [];
array_push($this->mimeTypes[$extension],$mimeType);
Copy link
Member

Choose a reason for hiding this comment

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

You can shorten the patch a bit by using[]:

$this->mimeTypes[$extension][] =$mimeType;

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

done.

Copy link
Member

@xabbuhxabbuh left a comment

Choose a reason for hiding this comment

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

with a minor change

@fabpot
Copy link
Member

Thank you@mcneely.

@fabpotfabpot merged commit6310084 intosymfony:4.4May 9, 2020
@fabpotfabpot mentioned this pull requestMay 16, 2020
This was referencedMay 31, 2020
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@fabpotfabpotfabpot approved these changes

@javiereguiluzjaviereguiluzjaviereguiluz approved these changes

@xabbuhxabbuhxabbuh approved these changes

@dunglasdunglasAwaiting requested review from dunglas

@jderussejderusseAwaiting requested review from jderusse

@lyrixxlyrixxAwaiting requested review from lyrixx

@srozesrozeAwaiting requested review from sroze

Assignees

No one assigned

Projects

None yet

Milestone

4.4

Development

Successfully merging this pull request may close these issues.

6 participants

@mcneely@xabbuh@nicolas-grekas@fabpot@javiereguiluz@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp