business-card-generator
business-card-generator copied to clipboard
http(s) prefix requirement in site field
A tilda in a vcard website URL causes an exception http://site.com/~user
Thanks for your feedback @aspeer06!
However I cannot reproduce this issue: https://business-card-generator.vercel.app/card?card_type=vcard&firstname=John&lastname=Doe&nickname=&picture=&birthday=&company=&job=&email=&phone=&website=http%3A%2F%2Fsite.com%2F%7Euser&street=&city=&zipcode=&state=&country=
Could you share a link with the issue happening please?
Actually I believe the error is anything in the site field that doesn't start with http(s). https://business-card-generator.vercel.app/card?card_type=vcard&firstname=John&lastname=Doe&nickname=&picture=&birthday=&company=&job=&email=&phone=&website=site.com&street=&city=&zipcode=&state=&country=
Sorry for delay in response
@aspeer06 What are you expecting here? Do you want to be able to display only mywebsite.com without a prefix?
A compliant website URL begins with either http:// or https:// prefix.
In HTML if you only specify a link to mywebsite.com, the browser will interpret it as a relative link to the app: business-card-generator.vercel.app/mywebsite.com, so it does not work natively without prefixes.
Potential solutions here:
- Stricter validation: currently, data validation is not performed when submitting the form, only when rendering QR codes which is a not great. When some parameters are non-conformant, display the form with errors
- Hide the website URL prefix: with a compliant website URL, the HTML rendering could hide the prefix for display but still use the proper URL link with prefix
- Allow website URL without prefix: the HTML rendering would have to smartly add the missing prefix when needed (by default
http://)
For now, I would rather stick with stricter validation and hiding the prefix only for display.
Stricter validation makes sense to me as well in the submission form.