Page 1 of 1

[NMDC] 4.10 Magnet Link left mouse in chat opens search

PostPosted: 12 Jan 2021, 23:09
by Executer

the following list of magnet links is not handled correctly
Code: Select all

It appears to me the "%26" -> & breaks the handling of the link and those in the same message below it.
Clicking on the link above brings the expected magnet link detected window to download the file, the broken one and those below open a search instead.
Clicking on the working link above fixes the ones not handled as expected until airdc++ gets restarted.
Right mouse -> download worked as expected in my test.

Code: Select all

%23 "#" breaks too.

so does
Code: Select all

%40 "@".

It seems to me does the copy magnet link and/or link handling in general are flawed and not robust when special or reserved characters in file names occur.
I've seen wierd things happening too, when someone used an opening parenthesis but didn't closed it in the filename. I understand does parsing and other things can get messed up by this, but normal users expect a "filename" to be simply handled as string and it should work as such even if it is not syntactically correct ;)

Re: 4.10 Magnet Link left mouse in chat opens search

PostPosted: 18 Jan 2021, 13:54
by maksis
This issue is reproducible only in NMDC hubs, as the links are working fine in ADC hubs

Re: 4.10 Magnet Link left mouse in chat opens search

PostPosted: 23 Jan 2021, 23:08
by Executer
maksis wrote:This issue is reproducible only in NMDC hubs, as the links are working fine in ADC hubs

To my knowledge the hub we run is ADC and not NMDC.

Not knowing the protocol intrinsics, i simply post my findings, will read up on the topic :)
Our hub where the issue arised is running luadch 2.19. No changes made to the hub recently and the current and older versions of Airdc++ are affected.
I setup a clean luadch 2.21, same issue.
A test hub with ADCH++ 2.12.1 shows the same issue.

I am no programmer or expert in URI (magnet link), but my impression is, does the issue arises around reserved characters in magnet links in the "dn" (Display Name) part. Uniform Resource Identifier (URI): Generic Syntax
2.2. Reserved Characters
gen-delims = ":" / "/" / "?" / "#" / "[" / "]" / "@"

sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
/ "*" / "+" / "," / ";" / "="

Test setup:
Assuming a clean hub main chat window (no chatlog, or containing no messages with a broken magnet link).
Connect with a fresh started Airdc++ client or close hub window between tests, a reconnect does not suffice, as it does not reset the link handling into a "clean" state.

The test message with the following structure
  1. magnet:?xt=urn:tree:tiger:MJINWSL5AJUTA7XKD4LYU77ZNV2O237R2HO6QLQ&xl=12&dn=i.txt
  2. magnet:?xt=urn:tree:tiger:T4WCVG3SFL4EZPVQV5PD2S6VTQOP3VW22FHXQ3A&xl=14&dn=sdk+%26+dfj.txt
  3. magnet:?xt=urn:tree:tiger:5MBKRFGPFAS74GO234WPHSMNL3PH53N5E47IDTY&xl=7&dn=f.txt
  4. magnet:?xt=urn:tree:tiger:TQ6K2U6YLFR4MBZ7JPVRHW2NOULXGQLXFTBMCXA&xl=6&dn=g.txt

  1. this link is fine
  2. this link contains a special character, breaking the handling of the link and the magnet links below it
  3. this link is fine, but broken by link 2
  4. this link is fine, but broken by link 2

The behaviour of Airdc++ is different depending the order in which the links are clicked.
Order: 4; 3; 2; 1; 4 ...
Search; Search; Search; Magnet Link detected (fixes the handling); Magnet Link detected

Order: 1; 2; 3; 4; 1 ...
Magnet Link detected, Magnet Link detected; Magnet Link detected ; Magnet Link detected; Magnet Link detected ...

Clicking the nonbroken link 1 fixes the link handling, in my test as long the client runs. Survives a reconnect. The situation resets when the window is closed or Airdc++ is closed.

If showing/reproducing the issue live helps clarifying things, feel free to contact me :)