-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Fix/improve avatar sync from LDAP #34573
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Use the correct function for hashing image data
Thanks for this PR, it seems there are some linting errors that pop-up. Would you be able to resolve those? |
lunny
approved these changes
May 31, 2025
wxiaoguang
reviewed
Jun 1, 2025
wxiaoguang
approved these changes
Jun 1, 2025
Co-authored-by: wxiaoguang <[email protected]>
Pull needs manual merge because it's from an org. |
GiteaBot
pushed a commit
to GiteaBot/gitea
that referenced
this pull request
Jun 2, 2025
This fixes 3 issues I encountered when debugging problems with our LDAP sync: 1. The comparison of the hashed image data in `IsUploadAvatarChanged` is wrong. It seems to be from before avatar hashing was changed and unified in go-gitea#22289. This results in the function always returning `true` for any avatars, even if they weren't changed. 2. Even if there's no avatar to upload (i.e. no avatar available for the LDAP entry), the upload function would still be called for every single user, only to then fail, because the data isn't valid. This is unnecessary. 3. Another small issue is that the comparison function (and thus hashing of data) is called for every user, even if there is no avatar attribute configured at all for the LDAP source. Thus, I switched the condition nesting, so that no cycles are wasted when avatar sync isn't configured in the first place. I also added a trace log for when there is actually a new avatar being uploaded for an existing user, which is now only shown when that is actually the case. --------- Co-authored-by: wxiaoguang <[email protected]>
silverwind
pushed a commit
that referenced
this pull request
Jun 2, 2025
Backport #34573 by @raucao This fixes 3 issues I encountered when debugging problems with our LDAP sync: 1. The comparison of the hashed image data in `IsUploadAvatarChanged` is wrong. It seems to be from before avatar hashing was changed and unified in #22289. This results in the function always returning `true` for any avatars, even if they weren't changed. 2. Even if there's no avatar to upload (i.e. no avatar available for the LDAP entry), the upload function would still be called for every single user, only to then fail, because the data isn't valid. This is unnecessary. 3. Another small issue is that the comparison function (and thus hashing of data) is called for every user, even if there is no avatar attribute configured at all for the LDAP source. Thus, I switched the condition nesting, so that no cycles are wasted when avatar sync isn't configured in the first place. I also added a trace log for when there is actually a new avatar being uploaded for an existing user, which is now only shown when that is actually the case. Co-authored-by: Râu Cao <[email protected]> Co-authored-by: wxiaoguang <[email protected]>
zjjhot
added a commit
to zjjhot/gitea
that referenced
this pull request
Jun 3, 2025
* giteaofficial/main: Refactor some tests (go-gitea#34580) Do not mutate incoming options to SearchRepositoryByName (go-gitea#34553) Fix/improve avatar sync from LDAP (go-gitea#34573) Fix some trivial problems (go-gitea#34579) Retain issue sort type when a keyword search is introduced (go-gitea#34559) Always use an empty line to separate the commit message and trailer (go-gitea#34512) Fix line-button issue after file selection in file tree (go-gitea#34574) [skip ci] Updated translations via Crowdin Fix doctor deleting orphaned issues attachments (go-gitea#34142) [skip ci] Updated translations via Crowdin Fix actions skipped commit status indicator (go-gitea#34507) Clean up "file-view" related styles (go-gitea#34558) Add "View workflow file" to Actions list page (go-gitea#34538) Do not mutate incoming options to RenderUserSearch and SearchUsers (go-gitea#34544) Add webhook assigning test and fix possible bug (go-gitea#34420) Fix possible nil description of pull request when migrating from CodeCommit (go-gitea#34541) Refactor commit reader (go-gitea#34542)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
backport/done
All backports for this PR have been created
backport/v1.24
This PR should be backported to Gitea 1.24
lgtm/done
This PR has enough approvals to get merged. There are no important open reservations anymore.
modifies/go
Pull requests that update Go code
type/bug
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This fixes 3 issues I encountered when debugging problems with our LDAP sync:
IsUploadAvatarChanged
is wrong. It seems to be from before avatar hashing was changed and unified in Unify hashing for avatar #22289. This results in the function always returningtrue
for any avatars, even if they weren't changed.I also added a trace log for when there is actually a new avatar being uploaded for an existing user, which is now only shown when that is actually the case.