mirror of
https://github.com/harness/drone.git
synced 2025-05-31 11:43:15 +00:00
limit text size for PRs in the migrator (#2662)
* limit text size for PRs in the migrator
This commit is contained in:
parent
1c8a47636f
commit
d96ee12399
@ -222,6 +222,15 @@ func (r *repoImportState) convertPullReq(
|
||||
createdAt := timestampMillis(extPullReq.Created, now)
|
||||
updatedAt := timestampMillis(extPullReq.Updated, now)
|
||||
|
||||
const maxTitleLen = 256
|
||||
const maxDescriptionLen = 100000 // This limit is deliberately higher than the limit in our API.
|
||||
if len(extPullReq.Title) > maxTitleLen {
|
||||
extPullReq.Title = extPullReq.Title[:maxTitleLen]
|
||||
}
|
||||
if len(extPullReq.Body) > maxDescriptionLen {
|
||||
extPullReq.Body = extPullReq.Body[:maxDescriptionLen]
|
||||
}
|
||||
|
||||
pr := &types.PullReq{
|
||||
ID: 0, // the ID will be populated in the data layer
|
||||
Version: 0,
|
||||
@ -400,6 +409,11 @@ func (r *repoImportState) createComment(
|
||||
resolvedBy = &commenter.ID
|
||||
}
|
||||
|
||||
const maxLenText = 64 << 10 // This limit is deliberately larger than the limit in our API.
|
||||
if len(extComment.Body) > maxLenText {
|
||||
extComment.Body = extComment.Body[:maxLenText]
|
||||
}
|
||||
|
||||
comment := &types.PullReqActivity{
|
||||
CreatedBy: commenter.ID,
|
||||
Created: commentedAt,
|
||||
|
Loading…
x
Reference in New Issue
Block a user