ensure skylink_rest is local

This commit is contained in:
Karol Wypchlo 2021-01-27 13:39:00 +01:00
parent 5576c223ce
commit 203ff0fd84
1 changed files with 3 additions and 0 deletions

View File

@ -176,6 +176,9 @@ server {
-- example response: '{"skylink":"sia://XABvi7JtJbQSMAcDwnUnmp2FKDPjg8_tTTFP4BwMSxVdEg"}'
local hnsres_json = json.decode(hnsres_res.body)
-- define local variable containing rest of the skylink if provided
local skylink_rest
if hnsres_json.skylink then
-- try to match the skylink with sia:// prefix
skylink, skylink_rest = string.match(hnsres_json.skylink, "sia://([^/?]+)(.*)")