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

Commit3816617

Browse files
MatTheCatnicolas-grekas
authored andcommitted
[HttpFoundation] Don’t check suffix on empty MIME type
1 parentd46df40 commit3816617

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

‎src/Symfony/Component/HttpFoundation/Request.php‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1259,8 +1259,8 @@ public function getFormat(?string $mimeType, bool $subtypeFallback = false): ?st
12591259
}
12601260
}
12611261

1262-
if (!$canonicalMimeType) {
1263-
$canonicalMimeType =$mimeType;
1262+
if (!$canonicalMimeType ??=$mimeType) {
1263+
returnnull;
12641264
}
12651265

12661266
if (str_starts_with($canonicalMimeType,'application/') &&str_contains($canonicalMimeType,'+')) {
@@ -1964,8 +1964,6 @@ protected static function initializeFormats(): void
19641964
}
19651965

19661966
/**
1967-
* Structured MIME suffix fallback formats
1968-
*
19691967
* This mapping is used when no exact MIME match is found in $formats.
19701968
* It enables handling of types like application/soap+xml → 'xml'.
19711969
*

‎src/Symfony/Component/HttpFoundation/Tests/RequestTest.php‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -538,9 +538,7 @@ public static function getFormatToMimeTypeMapProvider()
538538
];
539539
}
540540

541-
/**
542-
* @dataProvider getFormatWithSubtypeFallbackProvider
543-
*/
541+
#[DataProvider('getFormatWithSubtypeFallbackProvider')]
544542
publicfunctiontestGetFormatFromMimeTypeWithSubtypeFallback($expectedFormat,$mimeTypes)
545543
{
546544
$request =newRequest();

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp