Skip to content

Commit fd392ba

Browse files
committed
fix(jenkins): truncate primary_view to fit varchar(255) column
Fixes Error 1406 (22001): Data too long for column 'primary_view' by truncating the concatenated value to 255 characters before saving. Closes #8897
1 parent 5e9dfb8 commit fd392ba

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

backend/plugins/jenkins/models/response.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ func (j Job) ToJenkinsJob() *JenkinsJob {
6161
}
6262
}
6363

64+
primaryView := j.URL + j.Path + j.Class
65+
if len(primaryView) > 255 {
66+
primaryView = primaryView[:255]
67+
}
68+
6469
return &JenkinsJob{
6570
FullName: j.FullName,
6671
Name: j.Name,
@@ -70,7 +75,7 @@ func (j Job) ToJenkinsJob() *JenkinsJob {
7075
Base: j.Base,
7176
Url: j.URL,
7277
Description: j.Description,
73-
PrimaryView: j.URL + j.Path + j.Class,
78+
PrimaryView: primaryView,
7479
}
7580
}
7681

0 commit comments

Comments
 (0)