Skip to content

Instantly share code, notes, and snippets.

@fago
Created January 15, 2022 16:50
Show Gist options
  • Save fago/3987da661c0f402eb022fbb44369b3fe to your computer and use it in GitHub Desktop.
Save fago/3987da661c0f402eb022fbb44369b3fe to your computer and use it in GitHub Desktop.
Issue #3256828
From eda221fddcff4f97fb921e7889b7ac89ee8357f0 Mon Sep 17 00:00:00 2001
From: acbramley <[email protected]>
Date: Tue, 4 Jan 2022 00:58:31 +0000
Subject: [PATCH] Escape pipe characters in regex
---
core/modules/media/src/OEmbed/Endpoint.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/core/modules/media/src/OEmbed/Endpoint.php b/core/modules/media/src/OEmbed/Endpoint.php
index 920695c6e30..a449501850a 100644
--- a/core/modules/media/src/OEmbed/Endpoint.php
+++ b/core/modules/media/src/OEmbed/Endpoint.php
@@ -151,7 +151,7 @@ public function supportsDiscovery() {
public function matchUrl($url) {
foreach ($this->getSchemes() as $scheme) {
// Convert scheme into a valid regular expression.
- $regexp = str_replace(['.', '*', '?'], ['\.', '.*', '\?'], $scheme);
+ $regexp = str_replace(['.', '*', '?', '|'], ['\.', '.*', '\?', '\|'], $scheme);
if (preg_match("|^$regexp$|", $url)) {
return TRUE;
}
--
GitLab
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment