From 10f487a375b9e9cd4426bb64169ab8eb7f17a18b Mon Sep 17 00:00:00 2001 From: Oleg Krivtsov <olegkrivtsov@gmail.com> Date: Mon, 22 Nov 2021 17:23:58 +0700 Subject: [PATCH] fix(platform/gitlab): description is too long on GitLab (#12792) Co-authored-by: Michael Kriese <michael.kriese@visualon.de> --- lib/platform/gitlab/index.spec.ts | 10 ++++++++++ lib/platform/gitlab/index.ts | 2 ++ 2 files changed, 12 insertions(+) diff --git a/lib/platform/gitlab/index.spec.ts b/lib/platform/gitlab/index.spec.ts index 72e26a2970..b4714de7ed 100644 --- a/lib/platform/gitlab/index.spec.ts +++ b/lib/platform/gitlab/index.spec.ts @@ -1870,6 +1870,16 @@ These updates have all been created already. Click a checkbox below to force a r expect(smartTruncate).toHaveBeenCalledTimes(1); expect(smartTruncate).toHaveBeenCalledWith(expect.any(String), 25000); }); + + it('truncates description for API version gt 13.4', async () => { + jest.mock('../utils/pr-body'); + const { smartTruncate } = require('../utils/pr-body'); + + await initFakePlatform('13.4.1'); + gitlab.massageMarkdown(prBody); + expect(smartTruncate).toHaveBeenCalledTimes(1); + expect(smartTruncate).toHaveBeenCalledWith(expect.any(String), 1000000); + }); }); describe('getVulnerabilityAlerts()', () => { diff --git a/lib/platform/gitlab/index.ts b/lib/platform/gitlab/index.ts index 43e82367b2..97bb7e18cb 100644 --- a/lib/platform/gitlab/index.ts +++ b/lib/platform/gitlab/index.ts @@ -685,6 +685,8 @@ export function massageMarkdown(input: string): string { ); desc = smartTruncate(desc, 25000); + } else { + desc = smartTruncate(desc, 1000000); } return desc; -- GitLab