Add debug log for nil referencedPost (#18437)
* add debug log for nil post * add post id for context * log other vars that may be nil * change from Warn to Debug
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
0c84885132
Коммит
e575315275
@@ -5,6 +5,7 @@ package app
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"image"
|
"image"
|
||||||
"io"
|
"io"
|
||||||
@@ -490,16 +491,34 @@ func (a *App) getLinkMetadata(requestURL string, timestamp int64, isNewPost bool
|
|||||||
return nil, nil, nil, appErr
|
return nil, nil, nil, appErr
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if referencedPost == nil {
|
||||||
|
msg := "Referenced post is nil"
|
||||||
|
mlog.Debug(msg, mlog.String("post_id", referencedPostID))
|
||||||
|
return nil, nil, nil, errors.New(msg)
|
||||||
|
}
|
||||||
|
|
||||||
referencedChannel, appErr := a.GetChannel(referencedPost.ChannelId)
|
referencedChannel, appErr := a.GetChannel(referencedPost.ChannelId)
|
||||||
if appErr != nil {
|
if appErr != nil {
|
||||||
return nil, nil, nil, appErr
|
return nil, nil, nil, appErr
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if referencedChannel == nil {
|
||||||
|
msg := "Referenced channel is nil"
|
||||||
|
mlog.Debug(msg, mlog.String("channel_id", referencedPost.ChannelId))
|
||||||
|
return nil, nil, nil, errors.New(msg)
|
||||||
|
}
|
||||||
|
|
||||||
referencedTeam, appErr := a.GetTeam(referencedChannel.TeamId)
|
referencedTeam, appErr := a.GetTeam(referencedChannel.TeamId)
|
||||||
if appErr != nil {
|
if appErr != nil {
|
||||||
return nil, nil, nil, appErr
|
return nil, nil, nil, appErr
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if referencedTeam == nil {
|
||||||
|
msg := "Referenced team is nil"
|
||||||
|
mlog.Debug(msg, mlog.String("team_id", referencedChannel.TeamId))
|
||||||
|
return nil, nil, nil, errors.New(msg)
|
||||||
|
}
|
||||||
|
|
||||||
permalink = &model.Permalink{PreviewPost: model.NewPreviewPost(referencedPost, referencedTeam, referencedChannel)}
|
permalink = &model.Permalink{PreviewPost: model.NewPreviewPost(referencedPost, referencedTeam, referencedChannel)}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user