Strip the `sia://` prefix.

This commit is contained in:
Ivaylo Novakov 2020-08-05 17:40:16 +03:00
parent 6f408e49c9
commit 87a3cb8aa7
No known key found for this signature in database
GPG Key ID: 06B9354AB08BE9C6
1 changed files with 4 additions and 1 deletions

View File

@ -79,7 +79,10 @@ server.use(
userRes.redirect(307, `${userReq.path}/`); userRes.redirect(307, `${userReq.path}/`);
} }
if (headers.location && headers.location.match(startsWithSkylinkRegExp)) { if (headers.location && headers.location.match(startsWithSkylinkRegExp)) {
headers.location = headers.location.replace(startsWithSkylinkRegExp, `/hns/${userReq.params.name}`); headers.location = headers.location.replace(
startsWithSkylinkRegExp,
`/hns/${userReq.params.name.replace("sia://", "")}`
);
} }
return headers; return headers;