Fix potential nil dereference in app.isChannelArchivedAndHidden (#30628)

Этот коммит содержится в:
Claudio Costa
2025-04-03 15:31:09 -06:00
коммит произвёл GitHub
родитель a219fbcfa1
Коммит 7250095f86
2 изменённых файлов: 20 добавлений и 1 удалений

Просмотреть файл

@@ -85,13 +85,15 @@ func (a *App) SessionHasPermissionToChannel(c request.CTX, session model.Session
channel, appErr := a.GetChannel(c, channelID)
if appErr != nil && appErr.StatusCode == http.StatusNotFound {
return false
} else if appErr != nil {
c.Logger().Warn("Failed to get channel", mlog.String("channel_id", channelID), mlog.Err(appErr))
}
if session.IsUnrestricted() || a.RolesGrantPermission(session.GetUserRoles(), model.PermissionManageSystem.Id) {
return true
}
if a.isChannelArchivedAndHidden(channel) {
if appErr == nil && a.isChannelArchivedAndHidden(channel) {
return false
}