Details
-
Bug
-
Resolution: Duplicate
-
Major
-
None
-
2.4 M1
-
None
-
magnet, URI, patch
-
Medium
-
Description
XWiki doesn't handle freestanding magnet: links. But, even worse, wherever possible, every piece of Java and JavaScript code does its best to break a magnet link. Renderer seem to interpret [[Link label>>magnet:?xt=urn:tree:tiger:ABCDE...]] as a reference to some page inside "magnet" wiki. Magnet links are getting broken when the document is being loaded into GWT editor. GWT editor itself breaks newly created magnet links by putting "http://" behind them.
And there is no single place where it can be fixed. Problems are scattered across xwiki-core, xwiki-renderer, wem.wikimodel.org, Tiny_MCE, GWT Editor.
Unfortunatelly I didn't written down a list of files to be patched. However, there is a good guide: mailto URI. XWiki understands URLs using scheme://something format, but mailto: URIs aren't locators and doesn't have "//" after ":". So does magnet.
The major work is already done, mailto: is supported. It seems to be enough to duplicate every piece of code replacing "mailto:" with "magnet:" everywhere one can find "mailto". Of course it would be nice to make a list of allowed URIs adjustable, but it will take longer time to implement, especially modifying wem parser.
Also, since a new list of common URIs is going to be hardcoded, the list should be composed now. Two lists, actually: 1 list of URIs that can be used in references and a second list that can be used in freestanding links.
Parser should recognize "magnet:?abc" freestanding link, but shouldn't recognize "magnet:abc".
I vote for introducing xmpp: URIs support as well (aka Jabber).
xmpp: URI label generator should behave in the same way as mailto: URI label generator.
Magnet URI label generator should extract dn (filename) and xl (file length in bytes) parameters and display something like "klein_shock_doctrine.djvu (8.19 Mb)", "klein_shock_doctrine" when there is no xl (e. g. it's a directory) and "(magnet link)" when there is no dn. There are retarded clients that don't even put "dn" in magnet links, most notably BitTorrent clients.
Or, at least, magnet URI label generator should always display "(magnet link)".