Simplify regex. Remove dead code.
This commit is contained in:
parent
8ee13bb96c
commit
f3d918d7e2
|
@ -78,3 +78,4 @@ docker/data
|
|||
# Cache files
|
||||
__pycache__
|
||||
/.idea/
|
||||
/venv/
|
||||
|
|
|
@ -20,7 +20,7 @@ const clientOptions = {
|
|||
const client = new NodeClient(clientOptions);
|
||||
|
||||
// Match both `sia://HASH` and `HASH` links.
|
||||
const startsWithSkylinkRegExp = /^(sia:\/\/){0,1}[a-zA-Z0-9_-]{46}/;
|
||||
const startsWithSkylinkRegExp = /^(sia:\/\/)?[a-zA-Z0-9_-]{46}/;
|
||||
|
||||
const getDomainRecords = async (name) => {
|
||||
const response = await client.execute("getnameresource", [name]);
|
||||
|
@ -75,9 +75,6 @@ server.use(
|
|||
proxy("nginx", {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
userResHeaderDecorator(headers, userReq, userRes, proxyReq, proxyRes) {
|
||||
// if (!userReq.url.endsWith('/')) {
|
||||
// userRes.redirect(307, `${userReq.url}/`);
|
||||
// }
|
||||
if (headers.location && headers.location.match(startsWithSkylinkRegExp)) {
|
||||
headers.location = headers.location.replace(
|
||||
startsWithSkylinkRegExp,
|
||||
|
|
Reference in New Issue