Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/private/Route/Router.php
Original file line number Diff line number Diff line change
Expand Up @@ -442,8 +442,8 @@ protected function fixLegacyRootName(string $routeName): string {
if ($routeName === 'cloud_federation_api.requesthandlercontroller.receivenotification') {
return 'cloud_federation_api.requesthandler.receivenotification';
}
if ($routeName === 'core.ProfilePage.index') {
return 'profile.ProfilePage.index';
if ($routeName === 'core.profilepage.index') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is only for legacy reasons all apps - if needed - should use the profile.ProfilePage.index name.
As it was always named core.ProfilePage.index and just then migrated to the profile app.

The naming follows our long standing naming schema: appid.TheController.methodName.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. But what if our application works through NC 28 to NC 32 ? This "legacy" function seems better to use rather than "if NCVersion>=31"...

Anyway, as fixLegacyRootName is called just after a "strtolower" on $routeName, this test never works right now.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactly, that's why we need this fix.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if NCVersion>=31

Cleaner way is linktoroute and a check if the returned string is empty.

Then fallback to core.profilepage.index

public function linkToRoute(string $routeName, array $arguments = []): string {
return $this->router->generate($routeName, $arguments);
}

This comment was marked as resolved.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?? The test in fixLegacyRootName does not work right now, because the route is lowercased before it is called. It's up to this function to compare it in a correct lowercase. (That's the purpose of the PR)

Copy link

@smarinier smarinier Aug 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

public function generate($name,
	$parameters = [],
	$absolute = false) {
	$referenceType = UrlGenerator::ABSOLUTE_URL;
	if ($absolute === false) {
		$referenceType = UrlGenerator::ABSOLUTE_PATH;
	}
	/*
	 * The route name has to be lowercase, for symfony to match it correctly.
	 * This is required because smyfony allows mixed casing for controller names in the routes.
	 * To avoid breaking all the existing route names, registering and matching will only use the lowercase names.
	 * This is also safe on the PHP side because class and method names collide regardless of the casing.
	 */
	$name = strtolower($name);
	$name = $this->fixLegacyRootName($name);

return 'profile.profilepage.index';
}
return $routeName;
}
Expand Down
Loading