feat: Remove link length limit for admin user
All checks were successful
Build Docker / Build Main Image (push) Successful in 21s

This commit is contained in:
Nathan Woodburn 2023-11-18 21:53:13 +11:00
parent 5909552f6f
commit 031e07e2ff
Signed by: nathanwoodburn
GPG Key ID: 203B000478AD0EF1
2 changed files with 5 additions and 5 deletions

View File

@ -115,16 +115,16 @@ def add_link():
regexmatch = re.match(r"^https?://([a-z0-9]+(-[a-z0-9]+)*\.)*([a-z0-9]+(-[a-z0-9]+)*)(/([a-z0-9.#])+(-([a-z0-9.])+)?)*$", url)
if not regexmatch:
return error('Invalid domain')
return error('Invalid destination link')
if len(link) > 32:
return error('Link too long')
if len(link) < 5:
if len(link) < 5 and domain.lower() != ADMIN_DOMAIN:
return error('Link too short')
regexmatch = re.match(r"^[a-zA-Z0-9]+$", link)
if not regexmatch:
return error('Invalid link')
return error('Invalid link name')
# Verify link is not taken
if db.get_link(link) != False:

View File

@ -96,8 +96,8 @@
</div>
<div class="card-body">
<form class="text-center" method="post">
<div class="text-end"><label class="form-label" style="display: inline-block;">https://{{host}}/</label><input class="form-control form-control-sm" type="text" style="margin-top: 10px;display: inline-block;width: auto;" name="link" required="" minlength="5"></div>
<div class="text-end"><label class="form-label" style="display: inline-block;margin-right: 20px;">Links to</label><input class="form-control form-control-sm" type="text" style="margin-top: 10px;display: inline-block;width: auto;" placeholder="URL" name="url" required="" minlength="5"></div><input class="btn btn-primary" type="submit" style="margin: 10px;" value="Create">
<div class="text-end"><label class="form-label" style="display: inline-block;">https://{{host}}/</label><input class="form-control form-control-sm" type="text" style="margin-top: 10px;display: inline-block;width: auto;" name="link" required=""></div>
<div class="text-end"><label class="form-label" style="display: inline-block;margin-right: 20px;">Links to</label><input class="form-control form-control-sm" type="text" style="margin-top: 10px;display: inline-block;width: auto;" placeholder="URL" name="url" required=""></div><input class="btn btn-primary" type="submit" style="margin: 10px;" value="Create">
</form>
</div>
</div>