Skip to content

Commit ae7719d

Browse files
committed
use empty string instead of / in the replacement. This will upstream result in that the path passed to solid-crud is '/' for the root instead of an empty string.
1 parent f976fd9 commit ae7719d

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

solid/lib/Controller/GetStorageUrlTrait.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ final public function setUrlGenerator(IURLGenerator $urlGenerator): void
2929

3030
/**
3131
* @FIXME: Add check for bob.nextcloud.local/solid/alice to throw 404
32-
* @TODO: Use route without `@alice` in /apps/solid/@alice/profile/card#me when user-domains are enabled
32+
* @TODO: Use route without `~alice` in /apps/solid/~alice/profile/card#me when user-domains are enabled
3333
*/
3434
public function getStorageUrl($userId) {
3535
$routeUrl = $this->urlGenerator->linkToRoute(
@@ -39,8 +39,7 @@ public function getStorageUrl($userId) {
3939

4040
$storageUrl = $this->urlGenerator->getAbsoluteURL($routeUrl);
4141

42-
// (?) $storageUrl = preg_replace('/foo$/', '', $storageUrl);
43-
$storageUrl = preg_replace('/foo$/', '/', $storageUrl);
42+
$storageUrl = preg_replace('/foo$/', '', $storageUrl);
4443

4544
if ($this->config->getUserSubDomainsEnabled()) {
4645
$url = parse_url($storageUrl);
@@ -64,14 +63,14 @@ public function validateUrl(RequestInterface $request): bool {
6463
$pathParts = explode('/', $path);
6564

6665
$pathUsers = array_filter($pathParts, static function ($value) {
67-
return str_starts_with($value, '@');
66+
return str_starts_with($value, '~');
6867
});
6968

7069
if (count($pathUsers) === 1) {
7170
$pathUser = reset($pathUsers);
7271
$subDomainUser = explode('.', $host)[0];
7372

74-
$isValid = $pathUser === '@' . $subDomainUser;
73+
$isValid = $pathUser === '~' . $subDomainUser;
7574
}
7675

7776
return $isValid;

0 commit comments

Comments
 (0)