From 98ec6f5c1caf585dcf03e9d88da8b2dee42a2506 Mon Sep 17 00:00:00 2001 From: Ivaylo Novakov Date: Wed, 5 Aug 2020 13:35:31 +0300 Subject: [PATCH] Support both bare (no leading `sia://`) and full skylinks. --- handshake-api/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/handshake-api/index.js b/handshake-api/index.js index 6c00d2f4..f92ccf05 100644 --- a/handshake-api/index.js +++ b/handshake-api/index.js @@ -19,7 +19,8 @@ const clientOptions = { }; const client = new NodeClient(clientOptions); -const startsWithSkylinkRegExp = /^[a-zA-Z0-9_-]{46}/; +// Match both `sia://HASH` and `HASH` links. +const startsWithSkylinkRegExp = /^(sia:\/\/){0,1}[a-zA-Z0-9_-]{46}/; const getDomainRecords = async (name) => { const response = await client.execute("getnameresource", [name]);