Skip to content
Prev Previous commit
Next Next commit
Fix creation of legacy routes
Signed-off-by: Joas Schilling <[email protected]>
  • Loading branch information
nickvergessen authored and rullzer committed Apr 18, 2020
commit aad16c8508b11c54cd87122456642b8e20c774d3
29 changes: 29 additions & 0 deletions lib/private/Route/Router.php
Original file line number Diff line number Diff line change
Expand Up @@ -335,13 +335,42 @@ public function generate($name,
if ($absolute === false) {
$referenceType = UrlGenerator::ABSOLUTE_PATH;
}
$name = $this->fixLegacyRootName($name);
return $this->getGenerator()->generate($name, $parameters, $referenceType);
} catch (RouteNotFoundException $e) {
$this->logger->logException($e);
return '';
}
}

protected function fixLegacyRootName(string $routeName): string {
if ($routeName === 'files.viewcontroller.showFile') {
return 'files.View.showFile';
}
if ($routeName === 'files_sharing.sharecontroller.showShare') {
return 'files_sharing.Share.showShare';
}
if ($routeName === 'files_sharing.sharecontroller.showAuthenticate') {
return 'files_sharing.Share.showAuthenticate';
}
if ($routeName === 'files_sharing.sharecontroller.authenticate') {
return 'files_sharing.Share.authenticate';
}
if ($routeName === 'files_sharing.sharecontroller.downloadShare') {
return 'files_sharing.Share.downloadShare';
}
if ($routeName === 'files_sharing.publicpreview.directLink') {
return 'files_sharing.PublicPreview.directLink';
}
if ($routeName === 'cloud_federation_api.requesthandlercontroller.addShare') {
return 'cloud_federation_api.RequestHandler.addShare';
}
if ($routeName === 'cloud_federation_api.requesthandlercontroller.receiveNotification') {
return 'cloud_federation_api.RequestHandler.receiveNotification';
}
return $routeName;
}

/**
* To isolate the variable scope used inside the $file it is required in it's own method
*
Expand Down