Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: sanitizeMarkdown on packageName & prTitle #8795

Closed
wants to merge 29 commits into from

Conversation

ThibautMarechal
Copy link

@ThibautMarechal ThibautMarechal commented Feb 21, 2021

Changes:

Use sanitizeMarkdown for PrTitle & PackageName in the update table & onboarding pr-list.

Context:

I have a weird behavior using the platform bitbucket-server. Adding the zero-width character after the '@' fixed the issue.
image
it display '@testing/react-autosuggest' but the real packageName is '@type/react-autosuggest'.
(@ testing is coming from the package above)
It only hapend when the packageName is in a link.
It's now fixed by the sanitizeMarkdown function.

Documentation (please check one with an [x])

  • I have updated the documentation, or
  • No documentation update is required

How I've tested my work (please tick one)

I have verified these changes via:

  • Code inspection only, or
  • Newly added unit tests, or
  • No new tests but ran on a real repository, or
  • Both unit tests + ran on a real repository

@CLAassistant
Copy link

CLAassistant commented Feb 21, 2021

CLA assistant check
All committers have signed the CLA.

@rarkins
Copy link
Collaborator

rarkins commented Feb 22, 2021

Please create an issue to discuss the problem and possible solutions first. The solution you propose is now resulting in some double escaping, which is not ideal.

@JamieMagee
Copy link
Contributor

@ThibautMarechal Can you rebase your branch onto latest main and mark it ready for review? Thanks!

@ThibautMarechal ThibautMarechal marked this pull request as ready for review May 19, 2021 09:11

import { getPrBody } from '.';

describe('workers/pr/body', () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
describe('workers/pr/body', () => {
describe(getName(), () => {

@@ -0,0 +1,41 @@
import { platform } from '../../../../test/util';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
import { platform } from '../../../../test/util';
import { getName, platform } from '../../../../test/util';

Comment on lines 6 to 11
jest.mock('./config-description', () => ({
getPrConfigDescription: jest.fn(() => ''),
}));
jest.mock('./controls', () => ({
getControls: jest.fn(() => ''),
}));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
jest.mock('./config-description', () => ({
getPrConfigDescription: jest.fn(() => ''),
}));
jest.mock('./controls', () => ({
getControls: jest.fn(() => ''),
}));
jest.mock('./config-description');
jest.mock('./controls');

just use default mocks jests will do it's magic 🧙

let config: RenovateConfig;
beforeEach(() => {
config = getConfig();
platform.massageMarkdown = jest.fn((input) => input);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
platform.massageMarkdown = jest.fn((input) => input);
platform.massageMarkdown.mockImplementation((input) => input);

platform.massageMarkdown is already a mock 😉

@JamieMagee
Copy link
Contributor

Snapshots need to be updated yarn jest -u

Copy link
Collaborator

@rarkins rarkins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs running on a real repo to sanity check it

Copy link
Collaborator

@rarkins rarkins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs running on a real repo to sanity check it

@rarkins
Copy link
Collaborator

rarkins commented Jun 1, 2021

Needs running on a real repo to sanity check it

This still applies

@rarkins rarkins marked this pull request as draft June 1, 2021 15:39
@rarkins
Copy link
Collaborator

rarkins commented Jul 30, 2021

@ThibautMarechal were you able to verify this on one or more public repos?

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants