diff --git a/src/Appwrite/SDK/Specification/Format/OpenAPI3.php b/src/Appwrite/SDK/Specification/Format/OpenAPI3.php index bea2e112af..b47d716737 100644 --- a/src/Appwrite/SDK/Specification/Format/OpenAPI3.php +++ b/src/Appwrite/SDK/Specification/Format/OpenAPI3.php @@ -758,7 +758,7 @@ class OpenAPI3 extends Format $pathAliases = [$name, ...($param['aliases'] ?? [])]; $isPathParam = false; foreach ($pathAliases as $pathAlias) { - if (\preg_match('/:' . \preg_quote($pathAlias, '/') . '(?=\/|$)/', $url)) { + if (false !== \strpos($url, ':' . $pathAlias)) { $isPathParam = true; break; } @@ -806,11 +806,7 @@ class OpenAPI3 extends Format } foreach ($pathAliases as $pathAlias) { - $url = (string)\preg_replace( - '/:' . \preg_quote($pathAlias, '/') . '(?=\/|$)/', - '{' . $name . '}', - $url - ); + $url = \str_replace(':' . $pathAlias, '{' . $name . '}', $url); } } diff --git a/src/Appwrite/SDK/Specification/Format/Swagger2.php b/src/Appwrite/SDK/Specification/Format/Swagger2.php index f8a0395de8..61fa2919c9 100644 --- a/src/Appwrite/SDK/Specification/Format/Swagger2.php +++ b/src/Appwrite/SDK/Specification/Format/Swagger2.php @@ -725,7 +725,7 @@ class Swagger2 extends Format $pathAliases = [$name, ...($param['aliases'] ?? [])]; $isPathParam = false; foreach ($pathAliases as $pathAlias) { - if (\preg_match('/:' . \preg_quote($pathAlias, '/') . '(?=\/|$)/', $url)) { + if (\str_contains($url, ':' . $pathAlias)) { $isPathParam = true; break; } @@ -777,11 +777,7 @@ class Swagger2 extends Format } foreach ($pathAliases as $pathAlias) { - $url = (string)\preg_replace( - '/:' . \preg_quote($pathAlias, '/') . '(?=\/|$)/', - '{' . $name . '}', - $url - ); + $url = \str_replace(':' . $pathAlias, '{' . $name . '}', $url); } }