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

[stable25] Use the href of links for link previews, not node.textContent #3887

Merged
merged 2 commits into from
Mar 5, 2023

Conversation

backportbot-nextcloud[bot]
Copy link

@backportbot-nextcloud backportbot-nextcloud bot commented Mar 3, 2023

  • ⚠️ This backport had conflicts and is incomplete

backport of #3873

@backportbot-nextcloud backportbot-nextcloud bot added the bug Something isn't working label Mar 3, 2023
@backportbot-nextcloud backportbot-nextcloud bot added this to the Nextcloud 25.0.5 milestone Mar 3, 2023
mejo-

This comment was marked as outdated.

@cypress
Copy link

cypress bot commented Mar 3, 2023

1 flaky tests on run #8892 ↗︎

0 99 0 0 Flakiness 1

Details:

Merge 5716343 into b6d08ad...
Project: Text Commit: 570b6d11c5 ℹ️
Status: Passed Duration: 04:54 💡
Started: Mar 5, 2023 4:25 PM Ended: Mar 5, 2023 4:29 PM
Flakiness  cypress/e2e/sections.spec.js • 1 flaky test

View Output Video

Test Artifacts
Content Sections > Heading anchors > Anchor scrolls into view Output Screenshots

This comment has been generated by cypress-bot as a result of this project's GitHub integration settings.

@mejo- mejo- force-pushed the backport/3873/stable25 branch from bff106b to d7f177a Compare March 5, 2023 16:17
Until now we used node.textContent to determine whether a paragraph is
a link that warrants a link preview. Instead, we now check whether the
paragraph has a single text node wich is a link and use its href.

Text nodes with empty textContent are ignored in order to allow
whitespaces before and after the link.

This way we ensure to always show the preview of the link target, not of
the description text. Both may differ, which has security implications.

Also, links with a custom description get a link preview as well.

And last but not least, it fixes link previes for URLs with spaces.
(Background: for some reason, url-encoded spaces in textContent of links
get decoded when they're transformed to markdown and written to a file.
Therefore URLs with spaces lost their link preview once the Text session
was closed prior to this commit)

Fixes: #3871

Signed-off-by: Jonas <[email protected]>
@mejo- mejo- force-pushed the backport/3873/stable25 branch from d7f177a to 5716343 Compare March 5, 2023 16:18
Copy link
Member

@mejo- mejo- left a comment

Choose a reason for hiding this comment

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

Manually adjusted the backport now.

@mejo-
Copy link
Member

mejo- commented Mar 5, 2023

/compile

Signed-off-by: nextcloud-command <[email protected]>
@mejo- mejo- merged commit 546e55a into stable25 Mar 5, 2023
@delete-merged-branch delete-merged-branch bot deleted the backport/3873/stable25 branch March 5, 2023 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants