bhdicaire/vanityURLs

lnk doesn't check if a URL already has an existing shortcode before adding to static.lnk

Closed this issue · 1 comments

Steps to reproduce

$ echo "/felix https://felixleger.com"
$ bash bin/lnk https://felixleger.com

Expected behavior

# Randomized shortcode
$ bash bin/lnk https://felixleger.com
[Warning] "https://felixleger.com" is already being redirected with the following shortcode(s):
  - /felix
Do you want to continue creating a new random short code? (y/N):
Exiting without creating a new shortcode.

# Custom shortcode
$ bash bin/lnk https://felixleger.com /newcode
[Warning] "https://felixleger.com" is already being redirected with the following shortcode(s):
  - /felix
Do you want to continue adding "/newcode"? (y/N): 
Exiting without creting a new shortcode.

Actual behavior

[main c440f99] add redirect /H3H3H --> https://felixleger.com
 1 file changed, 1 insertion(+), 9 deletions(-)
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Delta compression using up to 12 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 346 bytes | 346.00 KiB/s, done.
Total 3 (delta 2), reused 0 (delta 0), pack-reused 0
To gitlab.com:felleg/felx-cc.git
   0a8c789..c440f99  main -> main
Your shortened URL is https://felx.cc/H3H3H
Please give ~15 seconds for your link to become valid

$ cat static.lnk
/felix https://felixleger.com
/H3H3H https://felixleger.com

System configuration

Using commit b3dbf15

Fixed by 50f4326