Remove max label length to avoid corrupting the build.#616
Remove max label length to avoid corrupting the build.#616mdealer wants to merge 2 commits intojenkinsci:masterfrom
Conversation
…a unicode char, which corrupts the whole build. If necessary, this should be done at the view level instead.
…task-step-plugin into remove-max-label-length
There was a problem hiding this comment.
The maximum label check is there so that the UI is reasonable and removing this would imply it is ok to support arbitrary long lines in the UI which is incorrect.
So I see 2 choices:
- make the max length configurable by a system property (I would discourage this, as it is unlikely to be tested in the UI anywhere) and follow up in the UI so it is truncated correctly / the UI performs correctly.
- make the trimming of the String unicode surrogate pair aware
As this label is there for the UI not any backend, I would see that trimming in the backend would be appropriate here.
2 would be something like the following (untested)
private String trim(String source, int maxLen) {
if(s.length() > maxLen) {
if (Character.isLowSurrogate(s.charAt(maxLen))) {
return s.substring(0, maxLen-1);
}
return s.substring(0,maxLen);
}
return s;
}
100 characters is quite arbitrary. The UI works just fine, it simply wraps to the next line. Maybe @jglick can add something? I remember already discussing this here. Also, to me the build.xml is not UI, it's the back end. I ran this for a while and I know it works, but I don't feel like cutting: |
Remove max label length limitation from back-end to avoid corrupting a build with Unicode text in label. Existing implementation may incorrectly cut a multi byte Unicode character and thus make it unreadable during deserialization.
Alternative would be to improve the cutting with graceful handling of Unicode, but that should be up to the UI, not back end. On my end the 100 char limit makes some of my pipelines unreadable as some labels just go slightly over 100 char limit.
Testing done
Submitter checklist