renovatebot / renovate

Home of the Renovate CLI: Cross-platform Dependency Automation by Mend.io
https://mend.io/renovate
GNU Affero General Public License v3.0
17.16k stars 2.24k forks source link

PackageName containing '@' character isn't display correctly in bitbucket-server #8803

Closed ThibautMarechal closed 11 months ago

ThibautMarechal commented 3 years ago

What Renovate type, platform and version are you using?

version: 24.42.1 platform: bitbucker-server

Describe the bug

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. Could be fixed using the sanitizeMarkdown function in the util folder.

Have you created a minimal reproduction repository?

Please read the minimal reproductions documentation to learn how to make a good minimal reproduction repository.

Additional context Draft PR: https://github.com/renovatebot/renovate/pull/8795

rarkins commented 3 years ago

What is the markdown code?

Also please expand your screenshot to include the full PR. e.g. you write "coming from the package above" but I don't see any package above.

github-actions[bot] commented 3 years ago

This issue has been labeled with status:requirements. This indicates that we don't know enough to start work and further requirements or a reproduction are needed first.

This label will be replaced with status:ready once all requirements and reproductions necessary to start work have been met.

If it's not clear what is missing to move this issue forward, ask for clarification in a new comment. If you think we already have what we need to move forward, mention this in a new comment.

ThibautMarechal commented 3 years ago

Bitbucket preview: image Markdown source: image

The sanitize function is adding ​ after the '@' and fix the issue

rarkins commented 3 years ago

So only the first @ is escaped?

That's also a very strange bug if Bitbucket's HTML is displaying something completely different from the markdown.

Can you reproduce this is a public bitbucket.org repo?

github-actions[bot] commented 3 years ago

Hi there,

The Renovate team needs your help! To fix the problem, we first need to know exactly what's causing the bug. A minimal reproduction help us to pinpoint the exact cause of the bug.

To get started, please read our guide on minimal reproductions to understand what is needed.

We may close the issue if you have not provided a minimal reproduction within two weeks. If you need more time, or are stuck, please ask for help or more time in a comment.

Good luck,

The Renovate team

ThibautMarechal commented 3 years ago

Sadly, it's a private repository 😕I don't have the time to setup a repository on bitbucket.org and configure renovate on it. It's only happening when the package has a link. It's not only the first one. Another example: image

ThibautMarechal commented 3 years ago

I did a simple snapshot test in the PR to validate the zero-width character is well added after the @ for packages with link. Let

rarkins commented 3 years ago

Can you reproduce it (privately) when there's only a single dependency being updated in a PR? Also don't worry about bitbucket.org - I misread which platform it is. Server and Cloud sometimes share code for frontend stuff like this but the majority of the codebase is separate, so it may not apply.

ThibautMarechal commented 3 years ago

When there is a single dependency, bitbucket-server display the correct text.

rarkins commented 3 years ago

So it requires two packages in a table, and both must have links? Or the problem occurs if the first has a link and the second does not?

Can you create the minimum PR possible that reproduces it, and copy and paste the entire markdown here using a code block so we can see it?

ThibautMarechal commented 3 years ago

To be clear, there is an issue in the markdown component from bitbucket UI (@ is used to tag users, it's probably because of that). But we can prevent that bug from happening in renovate. Renovate already escaped de '@' here: https://github.com/renovatebot/renovate/blob/master/lib/workers/pr/body/updates-table.ts#L65, but only when starting with @. (regex /^@/). It's not matching that : [@scope/package](link) I wanted just to remove the start condition but I found a function in the util folder that exactly does that. So to reduce duplicated code I use it

You can take my branch for that PR https://github.com/renovatebot/renovate/pull/8795/files. remove my fix and run the test that will fail: image

If you want the branch with the failing test (without the fix): https://github.com/ThibautMarechal/renovate/tree/withPackageNameBug

aravindparappil46 commented 3 years ago

I'm guessing my qualm is related to this issue, hence commenting here!

I can confirm that in BitBucket Cloud (with self-hosted renovate 24.89.2), the unicode for zero-width space is being printed in the Onboarding PR for packages that have an @ in their name (Links look good, just in the heading) image

I'm not facing the other issue mentioned by @ThibautMarechal where part of the package name is getting picked up from the package above.

Let me know if this is already taken care of/awaiting PR approval or I'm more than happy to contribute!

rarkins commented 3 years ago

I think best to raise as a separate issue.

JamieMagee commented 3 years ago

@ThibautMarechal I can't comment on the issue, as I'm not a BitBucket user, but the fix looks reasonable (replacing some custom string.replace calls with a pre-existing helper function).

Mause commented 2 years ago

This is still an issue unfortunately, on Bitbucket Server especially

ThibautMarechal commented 2 years ago

Seems to be fixed with bitbucket server 7.17.5

Mause commented 2 years ago

@ThibautMarechal Renovate does aim to support all versions of Bitbucket Server that are within support though, and the one I'm using is quite far behind

viceice commented 2 years ago

@Mause We try to support as much versions as possible, but we don't add new features for out-of-support versions. We also only fix bugs for those versions when they are easy to fix and maintain.

viceice commented 2 years ago

Wrong, we only support not EOL version, so we only support bitbucket server 7.2+

viceice commented 2 years ago

Reducing priority, as it's fixed in newer bitbucket server versions.