@@ -131,9 +131,24 @@ private function getProfileUrl($userId) {
131131 $ profileUrl = preg_replace ('/foo$/ ' , '' , $ profileUrl );
132132 return $ profileUrl ;
133133 }
134+
135+ private function build_url (array $ parts ) {
136+ return (isset ($ parts ['scheme ' ]) ? "{$ parts ['scheme ' ]}: " : '' ) .
137+ (isset ($ parts ['host ' ]) ? "// {$ parts ['host ' ]}" : '' ) .
138+ (isset ($ parts ['port ' ]) ? ": {$ parts ['port ' ]}" : '' ) .
139+ (isset ($ parts ['path ' ]) ? "{$ parts ['path ' ]}" : '' ) .
140+ (isset ($ parts ['query ' ]) ? "? {$ parts ['query ' ]}" : '' ) .
141+ (isset ($ parts ['fragment ' ]) ? "# {$ parts ['fragment ' ]}" : '' );
142+ }
143+
134144 private function getStorageUrl ($ userId ) {
135145 $ storageUrl = $ this ->urlGenerator ->getAbsoluteURL ($ this ->urlGenerator ->linkToRoute ("solid.storage.handleHead " , array ("userId " => $ userId , "path " => "foo " )));
136146 $ storageUrl = preg_replace ('/foo$/ ' , '/ ' , $ storageUrl );
147+ // if ($this->userDomains) {
148+ $ url = parse_url ($ storageUrl );
149+ $ url ['host ' ] = $ userId .'. ' .$ url ['host ' ];
150+ $ storageUrl = $ this ->build_url ($ url );
151+ // }
137152 return $ storageUrl ;
138153 }
139154
@@ -190,6 +205,7 @@ public function handleRequest($userId, $path) {
190205 * @NoCSRFRequired
191206 */
192207 public function handleGet ($ userId , $ path ) {
208+ //TODO: check that the $userId matches the userDomain, if enabled.
193209 return $ this ->handleRequest ($ userId , $ path );
194210 }
195211
@@ -287,6 +303,7 @@ private function getUserProfile($userId) {
287303 }
288304 }
289305 }
306+ //TODO: privateTypeIndex and publisTypeIndex need to user getStorageURL
290307 if ($ user !== null ) {
291308 $ profile = array (
292309 'id ' => $ userId ,
0 commit comments