Skip to content

Commit 6636565

Browse files
authored
Merge pull request #1435 from flaix/fix-authority-np
Fix crash in Gitblit Authority for deleted users
2 parents 0ca5cf2 + 1c86273 commit 6636565

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

releases.moxie

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ r34: {
1111
html: ~
1212
text: ~
1313
security: ~
14-
fixes: ~
14+
fixes:
15+
- Fix crash in Gitblit Authority when users were deleted from Gitblit but still had entries (certificates) in the Authority.
1516
changes:
1617
- Minimum Java required increased to Java 8
1718
additions: ~

src/main/java/com/gitblit/authority/GitblitAuthority.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,11 @@ private void load(File folder) {
299299
List<UserCertificateModel> list = UserCertificateConfig.KEY.parse(config).list;
300300
for (UserCertificateModel ucm : list) {
301301
ucm.user = userService.getUserModel(ucm.user.username);
302-
map.put(ucm.user.username, ucm);
302+
// Users may have been deleted, but are still present in authority.conf.
303+
// TODO: Currently this only keeps the app from crashing. It should provide means to show obsolete user entries and delete them.
304+
if (ucm.user != null) {
305+
map.put(ucm.user.username, ucm);
306+
}
303307
}
304308
} catch (IOException e) {
305309
e.printStackTrace();

0 commit comments

Comments
 (0)