Support both bare (no leading `sia://`) and full skylinks.

This commit is contained in:
Ivaylo Novakov 2020-08-05 13:35:31 +03:00
parent f896afada1
commit 98ec6f5c1c
No known key found for this signature in database
GPG Key ID: 06B9354AB08BE9C6
1 changed files with 2 additions and 1 deletions

View File

@ -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]);