Fix regex delimiter in plan Task 5
Task 4 implementer discovered that # delimiter conflicts with literal # inside [/?#] and [&#] character classes (PHP PCRE terminates the regex early). Same patterns repeat in Task 5; pre-update so a re-execution does not hit the same bug. Vimeo regex in Task 6 is unaffected (no literal # in pattern body). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -522,10 +522,10 @@ In `MediaUrlResolver.php`, modify `detectYouTube()` and add helper methods:
|
|||||||
private function detectYouTube(string $url): ?string
|
private function detectYouTube(string $url): ?string
|
||||||
{
|
{
|
||||||
$patterns = [
|
$patterns = [
|
||||||
'#^https?://youtu\.be/([A-Za-z0-9_-]{11})(?:[/?#]|$)#',
|
'~^https?://youtu\.be/([A-Za-z0-9_-]{11})(?:[/?#]|$)~',
|
||||||
'#^https?://(?:www\.|m\.)?youtube\.com/watch\?(?:[^#]*&)?v=([A-Za-z0-9_-]{11})(?:[&#]|$)#',
|
'~^https?://(?:www\.|m\.)?youtube\.com/watch\?(?:[^#]*&)?v=([A-Za-z0-9_-]{11})(?:[&#]|$)~',
|
||||||
'#^https?://(?:www\.|m\.)?youtube\.com/shorts/([A-Za-z0-9_-]{11})(?:[/?#]|$)#',
|
'~^https?://(?:www\.|m\.)?youtube\.com/shorts/([A-Za-z0-9_-]{11})(?:[/?#]|$)~',
|
||||||
'#^https?://(?:www\.|m\.)?youtube\.com/embed/([A-Za-z0-9_-]{11})(?:[/?#]|$)#',
|
'~^https?://(?:www\.|m\.)?youtube\.com/embed/([A-Za-z0-9_-]{11})(?:[/?#]|$)~',
|
||||||
];
|
];
|
||||||
$videoId = null;
|
$videoId = null;
|
||||||
foreach ($patterns as $p) {
|
foreach ($patterns as $p) {
|
||||||
|
|||||||
Reference in New Issue
Block a user