Bug 456877 - NeoChat link preview showing 1 as link for empty link
Summary: NeoChat link preview showing 1 as link for empty link
Status: RESOLVED FIXED
Alias: None
Product: NeoChat
Classification: Applications
Component: General (other bugs)
Version First Reported In: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Tobias Fella
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-07-18 18:14 UTC by Jan Bidler
Modified: 2022-07-18 19:21 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Bidler 2022-07-18 18:14:23 UTC
SUMMARY
If someone sends an empty link, it will be shown as "1"


STEPS TO REPRODUCE
1. Have someone send an empty link, like `[link]()`
2. Hover over it in NeoChat

OBSERVED RESULT
The link preview shows `1`

EXPECTED RESULT
The link preview should be empty, as it is not a valid link.

SOFTWARE/OS VERSIONS
Linux: Arch Linux
KDE Frameworks Version: 5.95.0
Qt Version: 5.15.5
NeoChat: self-compiled flatpak
Comment 1 Tobias Fella 2022-07-18 19:21:47 UTC
Git commit 916e7465f1fbec79b2c24b49a509498a0201aa54 by Tobias Fella.
Committed on 18/07/2022 at 19:18.
Pushed by tfella into branch 'master'.

Don't show a link preview for empty links

When hovering over a link without a target, qt5 will report the link target to be "1", which is wrong.
To work around this, we manually check if the link is "1" and if it is, we discard it.
In theory, this means that we won't get a preview for any link that actually *is* "1", but why would any link be "1"?

It's not worth reporting this to Qt since it seems fixed in Qt6

M  +1    -1    imports/NeoChat/Component/Timeline/RichLabel.qml

https://invent.kde.org/network/neochat/commit/916e7465f1fbec79b2c24b49a509498a0201aa54