business-card-generator icon indicating copy to clipboard operation
business-card-generator copied to clipboard

http(s) prefix requirement in site field

Open aspeer06 opened this issue 2 years ago • 4 comments

A tilda in a vcard website URL causes an exception http://site.com/~user

aspeer06 avatar Aug 03 '23 19:08 aspeer06

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?

rclement avatar Aug 10 '23 15:08 rclement

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 avatar Aug 24 '23 18:08 aspeer06

@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.

rclement avatar Aug 25 '23 05:08 rclement

Stricter validation makes sense to me as well in the submission form.

aspeer06 avatar Sep 05 '23 19:09 aspeer06