Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

http(s) prefix requirement in site field #178

Open
aspeer06 opened this issue Aug 3, 2023 · 4 comments
Open

http(s) prefix requirement in site field #178

aspeer06 opened this issue Aug 3, 2023 · 4 comments

Comments

@aspeer06
Copy link

aspeer06 commented Aug 3, 2023

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

@rclement
Copy link
Owner

@aspeer06
Copy link
Author

aspeer06 commented Aug 24, 2023

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 aspeer06 changed the title ~ in URL http(s) prefix requirement in site field Aug 24, 2023
@rclement
Copy link
Owner

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

@aspeer06
Copy link
Author

aspeer06 commented Sep 5, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants