Skip to content

Commit 72cbc44

Browse files
committed
test: handle empty prefix in WebDAV href pattern matching
Fix regex pattern construction in assertXpathValueMatchesPattern when prefixRemotePhp is empty. Previously, empty prefix resulted in double slash patterns (//dav/...) that failed to match actual single slash href values (/dav/...). Resolves "Unknown modifier 'd'" regex error in WebDAV property tests.
1 parent bacf0a1 commit 72cbc44

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

tests/acceptance/bootstrap/WebDavPropertiesContext.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1002,7 +1002,12 @@ public function assertXpathValueMatchesPattern(
10021002
$pattern = \preg_replace("/^\^/", "", $pattern);
10031003
$pattern = \ltrim($pattern, "\/");
10041004
$prefixRemotePhp = \rtrim(WebdavHelper::prefixRemotePhp(""), "/");
1005-
$pattern = "/^\/{$prefixRemotePhp}\/{$pattern}";
1005+
1006+
if ($prefixRemotePhp === '') {
1007+
$pattern = "/^\/{$pattern}";
1008+
} else {
1009+
$pattern = "/^\/{$prefixRemotePhp}\/{$pattern}";
1010+
}
10061011
}
10071012
$pattern = $this->featureContext->substituteInLineCodes(
10081013
$pattern,

tests/acceptance/features/coreApiWebdavOperations/propfind.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Feature: PROPFIND
4848
| password | %public% |
4949
When the public sends "PROPFIND" request to the last public link share using the public WebDAV API with password "%public%"
5050
Then the HTTP status code should be "207"
51-
And the value of the item "//d:href" in the response should match "/\*/dav\/public-files\/%public_token%\/$/"
51+
And the value of the item "//d:href" in the response should match "/\/dav\/public-files\/%public_token%\/$/"
5252
And the value of the item "//oc:public-link-share-owner" in the response should be "Alice"
5353

5454
@skipOnReva @issue-10071 @issue-10331

0 commit comments

Comments
 (0)