Closed RumoEL closed 3 years ago
Magnet is a type of URI, so parameters must be escaped.
On Sat, 27 Mar 2021, 06:49 RumoEL, @.***> wrote:
magnet:?xt=urn:btih:HASH&dn=Word1 Word2
MagnetLinkFileReader https://github.com/RumoEL/rumo-pas/blob/6063bdc2ca135def9299c770e257b6b460f3c8d7/bittorrentspy/src/main/java/com/github/rumoel/pas/bittorrentspy/dht/MagnetLinkFileReader.java#L48
java.lang.IllegalArgumentException: Invalid URI: magnet:?xt=urn:btih:HASH&dn=Word1 Word2 at bt.magnet.MagnetUriParser.parse(MagnetUriParser.java:94) at com.github.rumoel.pas.bittorrentspy.dht.MagnetLinkFileReader.lambda$readFromFile$0(MagnetLinkFileReader.java:48) at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195) at java.base/java.util.HashMap$KeySpliterator.forEachRemaining(HashMap.java:1603) at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913) at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578) at com.github.rumoel.pas.bittorrentspy.dht.MagnetLinkFileReader.readFromFile(MagnetLinkFileReader.java:53) at com.github.rumoel.pas.bittorrentspy.v3.trackers.impl.TrackerDHT.init(TrackerDHT.java:73) at com.github.rumoel.pas.bittorrentspy.v3.trackers.TrackerHandler.init(TrackerHandler.java:24) at com.github.rumoel.pas.bittorrentspy.v3.init.PBSInit.main(PBSInit.java:31) Caused by: java.net.URISyntaxException: Illegal character in opaque part at index (Word1#HERE#Word2): magnet:?xt=urn:btih:HASH&dn=Word1 Word2 at java.base/java.net.URI$Parser.fail(URI.java:2913) at java.base/java.net.URI$Parser.checkChars(URI.java:3084) at java.base/java.net.URI$Parser.parse(URI.java:3120) at java.base/java.net.URI.(URI.java:600) at bt.magnet.MagnetUriParser.parse(MagnetUriParser.java:92)
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/atomashpolskiy/bt/issues/154, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA4TJBXPXNZZE3XHSBWYGGDTFVWVPANCNFSM4Z4R4GQA .
1)is urlencode (%26dn%3DWord1+Word2) ok? 2)or use '\ ' (&dn=Word1\ Word2) ? 3)or "value" &dn ="Word1 Word2" what to use?
Yes, URL encode (%20)
On Sat, 27 Mar 2021, 11:21 RumoEL, @.***> wrote:
1)is urlencode ok? 2)or use '\ ' ? 3)or & dn = "Word1 Word2" 4)%26dn%3DWord1+Word2? what to use?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/atomashpolskiy/bt/issues/154#issuecomment-808707285, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA4TJBTAAWH6CMLL5ASI5BTTFWWSJANCNFSM4Z4R4GQA .
And only parameters, not the uri itself (i.e. '&' in parameter value must be encoded, but & delimiter must not)
On Sat, 27 Mar 2021, 12:39 Andrei Tomashpolskiy, @.***> wrote:
Yes, URL encode (%20)
On Sat, 27 Mar 2021, 11:21 RumoEL, @.***> wrote:
1)is urlencode ok? 2)or use '\ ' ? 3)or & dn = "Word1 Word2" 4)%26dn%3DWord1+Word2? what to use?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/atomashpolskiy/bt/issues/154#issuecomment-808707285, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA4TJBTAAWH6CMLL5ASI5BTTFWWSJANCNFSM4Z4R4GQA .
Thanks for the clarification. I don't know how to remove the 'bug' label. we close this issue
magnet:?xt=urn:btih:HASH&dn=Word1 Word2
MagnetLinkFileReader
java.lang.IllegalArgumentException: Invalid URI: magnet:?xt=urn:btih:HASH&dn=Word1 Word2 at bt.magnet.MagnetUriParser.parse(MagnetUriParser.java:94) at com.github.rumoel.pas.bittorrentspy.dht.MagnetLinkFileReader.lambda$readFromFile$0(MagnetLinkFileReader.java:48) at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195) at java.base/java.util.HashMap$KeySpliterator.forEachRemaining(HashMap.java:1603) at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913) at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578) at com.github.rumoel.pas.bittorrentspy.dht.MagnetLinkFileReader.readFromFile(MagnetLinkFileReader.java:53) at com.github.rumoel.pas.bittorrentspy.v3.trackers.impl.TrackerDHT.init(TrackerDHT.java:73) at com.github.rumoel.pas.bittorrentspy.v3.trackers.TrackerHandler.init(TrackerHandler.java:24) at com.github.rumoel.pas.bittorrentspy.v3.init.PBSInit.main(PBSInit.java:31) Caused by: java.net.URISyntaxException: Illegal character in opaque part at index (Word1#HERE#Word2): magnet:?xt=urn:btih:HASH&dn=Word1 Word2 at java.base/java.net.URI$Parser.fail(URI.java:2913) at java.base/java.net.URI$Parser.checkChars(URI.java:3084) at java.base/java.net.URI$Parser.parse(URI.java:3120) at java.base/java.net.URI.(URI.java:600)
at bt.magnet.MagnetUriParser.parse(MagnetUriParser.java:92)