Skip to content

Conversation

@backportbot-nextcloud
Copy link

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 26 milestone Mar 3, 2023
@cypress
Copy link

cypress bot commented Mar 3, 2023

2 flaky tests on run #8955 ↗︎

0 141 0 0 Flakiness 2

Details:

[stable26] Use the href of links for link previews, not `node.textContent`
Project: Text Commit: 8a4975b845
Status: Passed Duration: 04:08 💡
Started: Mar 8, 2023 10:22 AM Ended: Mar 8, 2023 10:27 AM
Flakiness  sync.spec.js • 1 flaky test

View Output Video

Test Artifacts
Sync > recovers from a lost connection Output Screenshots
Flakiness  share.spec.js • 1 flaky test

View Output Video

Test Artifacts
Open test.md in viewer > Share a file with download disabled shows an error Output Screenshots

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

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/stable26 branch from af8c4b3 to b13859e Compare March 8, 2023 10:00
@mejo-
Copy link
Member

mejo- commented Mar 8, 2023

/compile

Signed-off-by: nextcloud-command <[email protected]>
@juliusknorr juliusknorr merged commit 98326b1 into stable26 Mar 8, 2023
@delete-merged-branch delete-merged-branch bot deleted the backport/3873/stable26 branch March 8, 2023 11:38
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.

4 participants