Closed cryptix closed 6 years ago
here is the output of npm_ls.txt of that patchbay installation. 'm not sure why it says ssb-ref is unmet. I linked in my local checkout with this fix.
@cryptix Is there a way to repro this crash with just ssb-ref?
I wish I knew... for me it started when I moved my key and resynced everything.
Is the fact that it's returning null
the problem, or is ssb-ref crashing Node? Sorry, trying to be helpful but I'm not sure I completely understand.
const ssbRef = require('ssb-ref')
ssbRef.parseMultiServerInvite('http://standardjs.com/') // => null
I’m not sure why it’s checking them for invites in the first place but the big problem for me is that it’s crashing sbot, yes.
I guess a ws:// addr might count as an multiserver address invite so I get why the pattern matches at least.
I’d say we should merge this. It’s an okay validation, I think... or make a try {} around this area.
Oh, I was mostly just thinking I'd like to write a test for it, but the !Array.isArray()
check LGTM.
I might suggest either adding instructions to the console.trace
or removing it -- is there something that developers using ssb-ref should be doing differently if they see the trace, or was that just for your debugging? We could also just check if (addr == null)
, since it should be returning undefined
on failure.
aha, the problem was that a http url is technically a multiserver address. This isn't really what was intended, so to stay consistent with previous behaviour. I've added a check that an address must be have at least an transport and transform part, by checking for the presense of an unescaped ~ separator. I'm not sure if I want to go down the road of making ssb-ref be aware of the supported protocols yet. Maybe that is a good idea, but I'd rather leave it to this for now.
merged into 2.13.2 with test coverage
somhow I'm getting
http://
urls through this code path which don't have a multiaddr representation. addr is then false / can't be indexed and thus my node crashes.It looks like the markdown parser tries to check if these are invites or something?!