Bug 456877

Summary: NeoChat link preview showing 1 as link for empty link
Product: [Applications] NeoChat Reporter: Jan Bidler <janbidler00>
Component: GeneralAssignee: Tobias Fella <fella>
Status: RESOLVED FIXED    
Severity: normal CC: carl
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

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