If a link is attached to two specific magnets:
The code generated by Copy As JS is (in 7.5 test (v181.3 r293120)) losing those specific attachments when run – the link reroutes to whichever pair of magnets are closest.
It turns out that that a fix / workaround is to reorder the code lines. The .head and .tail properties need to be specified before (and not after) .headMagnet and .tailMagnet.
( Various other properties also seem to be sensitive in this way to code order. Text properties are lost if they are specified before text content, for example )
UPDATE Reading the release notes, I notice that the clearing of text properties when a text string is assigned has been fixed now.
Perhaps the clearing of .headMagnet and .tailMagnet settings when .head and .tail are set is also not by design ?