MM-39420: Checks for presence of slice before index access. (#18826)
* MM-39420: Checks for presence of slice before index access. * MM-39420: Sanitize all embeds with single method. * MM-39420: Already checking len in method.
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
7287da6391
Коммит
412e52894c
@@ -601,16 +601,11 @@ func (a *App) SendNotifications(post *model.Post, team *model.Team, channel *mod
|
||||
a.sanitizeProfiles(userThread.Participants, false)
|
||||
userThread.Post.SanitizeProps()
|
||||
|
||||
previewPost := post.GetPreviewPost()
|
||||
if previewPost != nil {
|
||||
previewedChannel, err := a.GetChannel(previewPost.Post.ChannelId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if previewedChannel != nil && !a.HasPermissionToReadChannel(uid, previewedChannel) {
|
||||
userThread.Post.Metadata.Embeds[0].Data = nil
|
||||
}
|
||||
sanitizedPost, err := a.SanitizePostMetadataForUser(userThread.Post, uid)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
userThread.Post = sanitizedPost
|
||||
|
||||
payload, jsonErr := json.Marshal(userThread)
|
||||
if jsonErr != nil {
|
||||
|
||||
Ссылка в новой задаче
Block a user