-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Change "core.ProfilePage.index" to lowercase #54530
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Signed-off-by: zak39 <fotia.baptiste@hotmail.com>
7f66470 to
a98ba27
Compare
|
The matching should be case-insensitive (as there have been ugly problems before). |
| } | ||
| if ($routeName === 'core.ProfilePage.index') { | ||
| return 'profile.ProfilePage.index'; | ||
| if ($routeName === 'core.profilepage.index') { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
server/lib/private/URLGenerator.php
Lines 80 to 82 in c21e189
| public function linkToRoute(string $routeName, array $arguments = []): string { | |
| return $this->router->generate($routeName, $arguments); | |
| } |
server/lib/private/Route/Router.php
Line 416 in a957e3a
| return ''; |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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);
susnux
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from usage this is correct
|
Thanks for your first pull request and welcome to the community! Feel free to keep them coming! If you are looking for issues to tackle then have a look at this selection: https://github.com/nextcloud/server/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22 |
|
Thanks for merging this PR :) Could you please backport it to the stable 31 branch? |
|
You can do this as well ;) |
|
/backport to stable31 |
|
/backport to stable30 please |
|
The backport to # Switch to the target branch and update it
git checkout stable30
git pull origin stable30
# Create the new backport branch
git checkout -b backport/54530/stable30
# Cherry pick the change from the commit sha1 of the change against the default branch
# This might cause conflicts, resolve them
git cherry-pick a98ba27a
# Push the cherry pick commit to the remote repository and open a pull request
git push origin backport/54530/stable30Error: Failed to check for changes with origin/stable30: No changes found in backport branch Learn more about backports at https://docs.nextcloud.com/server/stable/go.php?to=developer-backports. |
|
Hello there, We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process. Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6 Thank you for contributing to Nextcloud and we hope to hear from you soon! (If you believe you should not receive this message, you can add yourself to the blocklist.) |
Summary
Hi, as an app developer, when I generate a link to a user profile, my button redirects me to the instance root instead of the user profile.
To fix this issue, we need to pass core.ProfilePage in lowercase.
Please, if you merge this PR, could you also backport it to stable31?
TODO
Checklist