Skip to content

Commit 7452d01

Browse files
committed
replace @ with ~ in urls
1 parent 5e71802 commit 7452d01

6 files changed

Lines changed: 38 additions & 38 deletions

File tree

solid/appinfo/routes.php

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
*/
1010
return [
1111
'routes' => [
12-
['name' => 'page#profile', 'url' => '/@{userId}/', 'verb' => 'GET'],
12+
['name' => 'page#profile', 'url' => '/~{userId}/', 'verb' => 'GET'],
1313
['name' => 'page#approval', 'url' => '/sharing/{clientId}', 'verb' => 'GET'],
1414
['name' => 'page#handleRevoke', 'url' => '/revoke/{clientId}', 'verb' => 'GET'],
1515
['name' => 'page#handleApproval', 'url' => '/sharing/{clientId}', 'verb' => 'POST'],
16-
['name' => 'page#dataJson', 'url' => '/@{userId}/data.json', 'verb' => 'GET' ],
16+
['name' => 'page#dataJson', 'url' => '/~{userId}/data.json', 'verb' => 'GET' ],
1717

1818
['name' => 'server#cors', 'url' => '/{path}', 'verb' => 'OPTIONS', 'requirements' => array('path' => '.+') ],
1919
['name' => 'server#authorize', 'url' => '/authorize', 'verb' => 'GET'],
@@ -25,31 +25,31 @@
2525
['name' => 'server#register', 'url' => '/register', 'verb' => 'POST'],
2626
['name' => 'server#registeredClient', 'url' => '/register/{clientId}', 'verb' => 'GET'],
2727

28-
['name' => 'profile#handleGet', 'url' => '/@{userId}/profile{path}', 'verb' => 'GET', 'requirements' => array('path' => '.+')],
29-
['name' => 'profile#handlePut', 'url' => '/@{userId}/profile{path}', 'verb' => 'PUT', 'requirements' => array('path' => '.+')],
30-
['name' => 'profile#handlePatch', 'url' => '/@{userId}/profile{path}', 'verb' => 'PATCH', 'requirements' => array('path' => '.+')],
31-
['name' => 'profile#handleHead', 'url' => '/@{userId}/profile{path}', 'verb' => 'HEAD', 'requirements' => array('path' => '.+')],
28+
['name' => 'profile#handleGet', 'url' => '/~{userId}/profile{path}', 'verb' => 'GET', 'requirements' => array('path' => '.+')],
29+
['name' => 'profile#handlePut', 'url' => '/~{userId}/profile{path}', 'verb' => 'PUT', 'requirements' => array('path' => '.+')],
30+
['name' => 'profile#handlePatch', 'url' => '/~{userId}/profile{path}', 'verb' => 'PATCH', 'requirements' => array('path' => '.+')],
31+
['name' => 'profile#handleHead', 'url' => '/~{userId}/profile{path}', 'verb' => 'HEAD', 'requirements' => array('path' => '.+')],
3232

33-
['name' => 'storage#handleGet', 'url' => '/@{userId}/storage{path}', 'verb' => 'GET', 'requirements' => array('path' => '.+')],
34-
['name' => 'storage#handlePost', 'url' => '/@{userId}/storage{path}', 'verb' => 'POST', 'requirements' => array('path' => '.+')],
35-
['name' => 'storage#handlePut', 'url' => '/@{userId}/storage{path}', 'verb' => 'PUT', 'requirements' => array('path' => '.+')],
36-
['name' => 'storage#handleDelete', 'url' => '/@{userId}/storage{path}', 'verb' => 'DELETE', 'requirements' => array('path' => '.+')],
37-
['name' => 'storage#handlePatch', 'url' => '/@{userId}/storage{path}', 'verb' => 'PATCH', 'requirements' => array('path' => '.+')],
38-
['name' => 'storage#handleHead', 'url' => '/@{userId}/storage{path}', 'verb' => 'HEAD', 'requirements' => array('path' => '.+')],
33+
['name' => 'storage#handleGet', 'url' => '/~{userId}/storage{path}', 'verb' => 'GET', 'requirements' => array('path' => '.+')],
34+
['name' => 'storage#handlePost', 'url' => '/~{userId}/storage{path}', 'verb' => 'POST', 'requirements' => array('path' => '.+')],
35+
['name' => 'storage#handlePut', 'url' => '/~{userId}/storage{path}', 'verb' => 'PUT', 'requirements' => array('path' => '.+')],
36+
['name' => 'storage#handleDelete', 'url' => '/~{userId}/storage{path}', 'verb' => 'DELETE', 'requirements' => array('path' => '.+')],
37+
['name' => 'storage#handlePatch', 'url' => '/~{userId}/storage{path}', 'verb' => 'PATCH', 'requirements' => array('path' => '.+')],
38+
['name' => 'storage#handleHead', 'url' => '/~{userId}/storage{path}', 'verb' => 'HEAD', 'requirements' => array('path' => '.+')],
3939

40-
['name' => 'calendar#handleGet', 'url' => '/@{userId}/calendar{path}', 'verb' => 'GET', 'requirements' => array('path' => '.+')],
41-
['name' => 'calendar#handlePost', 'url' => '/@{userId}/calendar{path}', 'verb' => 'POST', 'requirements' => array('path' => '.+')],
42-
['name' => 'calendar#handlePut', 'url' => '/@{userId}/calendar{path}', 'verb' => 'PUT', 'requirements' => array('path' => '.+')],
43-
['name' => 'calendar#handleDelete', 'url' => '/@{userId}/calendar{path}', 'verb' => 'DELETE', 'requirements' => array('path' => '.+')],
44-
['name' => 'calendar#handlePatch', 'url' => '/@{userId}/calendar{path}', 'verb' => 'PATCH', 'requirements' => array('path' => '.+')],
45-
['name' => 'calendar#handleHead', 'url' => '/@{userId}/calendar{path}', 'verb' => 'HEAD', 'requirements' => array('path' => '.+')],
40+
['name' => 'calendar#handleGet', 'url' => '/~{userId}/calendar{path}', 'verb' => 'GET', 'requirements' => array('path' => '.+')],
41+
['name' => 'calendar#handlePost', 'url' => '/~{userId}/calendar{path}', 'verb' => 'POST', 'requirements' => array('path' => '.+')],
42+
['name' => 'calendar#handlePut', 'url' => '/~{userId}/calendar{path}', 'verb' => 'PUT', 'requirements' => array('path' => '.+')],
43+
['name' => 'calendar#handleDelete', 'url' => '/~{userId}/calendar{path}', 'verb' => 'DELETE', 'requirements' => array('path' => '.+')],
44+
['name' => 'calendar#handlePatch', 'url' => '/~{userId}/calendar{path}', 'verb' => 'PATCH', 'requirements' => array('path' => '.+')],
45+
['name' => 'calendar#handleHead', 'url' => '/~{userId}/calendar{path}', 'verb' => 'HEAD', 'requirements' => array('path' => '.+')],
4646

47-
['name' => 'contacts#handleGet', 'url' => '/@{userId}/contacts{path}', 'verb' => 'GET', 'requirements' => array('path' => '.+')],
48-
['name' => 'contacts#handlePost', 'url' => '/@{userId}/contacts{path}', 'verb' => 'POST', 'requirements' => array('path' => '.+')],
49-
['name' => 'contacts#handlePut', 'url' => '/@{userId}/contacts{path}', 'verb' => 'PUT', 'requirements' => array('path' => '.+')],
50-
['name' => 'contacts#handleDelete', 'url' => '/@{userId}/contacts{path}', 'verb' => 'DELETE', 'requirements' => array('path' => '.+')],
51-
['name' => 'contacts#handlePatch', 'url' => '/@{userId}/contacts{path}', 'verb' => 'PATCH', 'requirements' => array('path' => '.+')],
52-
['name' => 'contacts#handleHead', 'url' => '/@{userId}/contacts{path}', 'verb' => 'HEAD', 'requirements' => array('path' => '.+')],
47+
['name' => 'contacts#handleGet', 'url' => '/~{userId}/contacts{path}', 'verb' => 'GET', 'requirements' => array('path' => '.+')],
48+
['name' => 'contacts#handlePost', 'url' => '/~{userId}/contacts{path}', 'verb' => 'POST', 'requirements' => array('path' => '.+')],
49+
['name' => 'contacts#handlePut', 'url' => '/~{userId}/contacts{path}', 'verb' => 'PUT', 'requirements' => array('path' => '.+')],
50+
['name' => 'contacts#handleDelete', 'url' => '/~{userId}/contacts{path}', 'verb' => 'DELETE', 'requirements' => array('path' => '.+')],
51+
['name' => 'contacts#handlePatch', 'url' => '/~{userId}/contacts{path}', 'verb' => 'PATCH', 'requirements' => array('path' => '.+')],
52+
['name' => 'contacts#handleHead', 'url' => '/~{userId}/contacts{path}', 'verb' => 'HEAD', 'requirements' => array('path' => '.+')],
5353

5454
['name' => 'solidWebhook#listWebhooks', 'url' => '/webhook/list', 'verb' => 'GET'],
5555
['name' => 'solidWebhook#register', 'url' => '/webhook/register', 'verb' => 'POST'],

solid/lib/Controller/CalendarController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,8 @@ public function handlePut() { // $userId, $path) {
186186
// throw an error about accessing put twice, so we will find out the userId and path from $_SERVER instead;
187187

188188
// because we got here, the request uri should look like:
189-
// /index.php/apps/solid/@{userId}/storage{path}
190-
$pathInfo = explode("@", $_SERVER['REQUEST_URI']);
189+
// /index.php/apps/solid/~{userId}/storage{path}
190+
$pathInfo = explode("~", $_SERVER['REQUEST_URI']);
191191
$pathInfo = explode("/", $pathInfo[1], 2);
192192
$userId = $pathInfo[0];
193193
$path = $pathInfo[1];

solid/lib/Controller/ContactsController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,8 @@ public function handlePut() { // $userId, $path) {
187187
// throw an error about accessing put twice, so we will find out the userId and path from $_SERVER instead;
188188

189189
// because we got here, the request uri should look like:
190-
// /index.php/apps/solid/@{userId}/storage{path}
191-
$pathInfo = explode("@", $_SERVER['REQUEST_URI']);
190+
// /index.php/apps/solid/~{userId}/storage{path}
191+
$pathInfo = explode("~", $_SERVER['REQUEST_URI']);
192192
$pathInfo = explode("/", $pathInfo[1], 2);
193193
$userId = $pathInfo[0];
194194
$path = $pathInfo[1];

solid/lib/Controller/ProfileController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,8 @@ public function handlePut() { // $userId, $path) {
207207
// throw an error about accessing put twice, so we will find out the userId and path from $_SERVER instead;
208208

209209
// because we got here, the request uri should look like:
210-
// /index.php/apps/solid/@{userId}/storage{path}
211-
$pathInfo = explode("@", $_SERVER['REQUEST_URI']);
210+
// /index.php/apps/solid/~{userId}/storage{path}
211+
$pathInfo = explode("~", $_SERVER['REQUEST_URI']);
212212
$pathInfo = explode("/", $pathInfo[1], 2);
213213
$userId = $pathInfo[0];
214214
$path = $pathInfo[1];

solid/lib/Controller/SolidWebhookController.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -162,13 +162,13 @@ private function initializeStorage($userId) {
162162
}
163163

164164
private function parseTopic($topic) {
165-
// topic = https://nextcloud.server/solid/@alice/storage/foo/bar
165+
// topic = https://nextcloud.server/solid/~alice/storage/foo/bar
166166
$appBaseUrl = $this->getAppBaseUrl(); // https://nextcloud.server/solid/
167-
$internalUrl = str_replace($appBaseUrl, '', $topic); // @alice/storage/foo/bar
167+
$internalUrl = str_replace($appBaseUrl, '', $topic); // ~alice/storage/foo/bar
168168
$pathicles = explode("/", $internalUrl);
169-
$userId = $pathicles[0]; // @alice
170-
$userId = preg_replace("/^@/", "", $userId); // alice
171-
$storageUrl = $this->getStorageUrl($userId); // https://nextcloud.server/solid/@alice/storage/
169+
$userId = $pathicles[0]; // ~alice
170+
$userId = preg_replace("/^~/", "", $userId); // alice
171+
$storageUrl = $this->getStorageUrl($userId); // https://nextcloud.server/solid/~alice/storage/
172172
$storagePath = str_replace($storageUrl, '/', $topic); // /foo/bar
173173
return array(
174174
"userId" => $userId,
@@ -194,7 +194,7 @@ private function createGetRequest($topic) {
194194
}
195195

196196
private function checkReadAccess($topic) {
197-
// split out $topic into $userId and $path https://nextcloud.server/solid/@alice/storage/foo/bar
197+
// split out $topic into $userId and $path https://nextcloud.server/solid/~alice/storage/foo/bar
198198
// - userId in this case is the pod owner (not the one doing the request). (alice)
199199
// - path is the path within the storage pod (/foo/bar)
200200
$target = $this->parseTopic($topic);

solid/lib/Controller/StorageController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -379,8 +379,8 @@ public function handlePut() { // $userId, $path) {
379379
// throw an error about accessing put twice, so we will find out the userId and path from $_SERVER instead;
380380

381381
// because we got here, the request uri should look like:
382-
// /index.php/apps/solid/@{userId}/storage{path}
383-
$pathInfo = explode("@", $_SERVER['REQUEST_URI']);
382+
// /index.php/apps/solid/~{userId}/storage{path}
383+
$pathInfo = explode("~", $_SERVER['REQUEST_URI']);
384384
$pathInfo = explode("/", $pathInfo[1], 2);
385385
$userId = $pathInfo[0];
386386
$path = $pathInfo[1];

0 commit comments

Comments
 (0)