-
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 href of links instead of node.textContent
for link previews
#3871
Comments
github-project-automation
bot
moved this to 🧭 Planning evaluation (don't pick)
in 📝 Office team
Mar 2, 2023
mejo-
moved this from 🧭 Planning evaluation (don't pick)
to 📄 To do (~10 entries)
in 📝 Office team
Mar 2, 2023
mejo-
changed the title
Use href of links instead of
Use href of links instead of Mar 2, 2023
node.textContent
for link previews instead ofnode.textContent
for link previews
mejo-
added a commit
that referenced
this issue
Mar 2, 2023
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 <jonas@freesources.org>
4 tasks
mejo-
added a commit
that referenced
this issue
Mar 3, 2023
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 <jonas@freesources.org>
mejo-
added a commit
that referenced
this issue
Mar 3, 2023
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 <jonas@freesources.org>
github-project-automation
bot
moved this from 📄 To do (~10 entries)
to ☑️ Done
in 📝 Office team
Mar 3, 2023
backportbot-nextcloud bot
pushed a commit
that referenced
this issue
Mar 3, 2023
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 <jonas@freesources.org>
backportbot-nextcloud bot
pushed a commit
that referenced
this issue
Mar 3, 2023
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 <jonas@freesources.org>
mejo-
added a commit
that referenced
this issue
Mar 5, 2023
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 <jonas@freesources.org>
mejo-
added a commit
that referenced
this issue
Mar 5, 2023
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 <jonas@freesources.org>
mejo-
added a commit
that referenced
this issue
Mar 8, 2023
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 <jonas@freesources.org>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
Currently we use
node.textContent
to determine whether a paragraph is a link that warrants a link preview. Instead, we should check whether the paragraph has a link mark and use its href.Reasons for this change would be:
textContent
of links get decoded when transformed to markdown. Spaces are not regarded in the regex that checks for URLs. Therefore URLs with spaces loose their link preview once the Text session is closed.I'll take a look into implementing this change.
@julien-nc would be interested in your opinion on that.
The text was updated successfully, but these errors were encountered: