-
Notifications
You must be signed in to change notification settings - Fork 94
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
Use the href of links for link previews, not node.textContent
#3873
Conversation
2 flaky tests on run #8849 ↗︎
Details:
sync.spec.js • 1 flaky test
share.spec.js • 1 flaky test
This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, thanks for the quick fixing :)
/backport to stable26 |
/backport to stable25 |
dcc44fd
to
2fc65e7
Compare
/compile |
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]>
38e15e2
to
35db3d4
Compare
/compile |
Signed-off-by: nextcloud-command <[email protected]>
The backport to stable25 failed. Please do this backport manually. |
/backport 35db3d4 to stable25 |
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
🏁 Checklist
npm run lint
/npm run stylelint
/composer run cs:check
)