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

handle app store url scheme #438

Merged
merged 2 commits into from
Dec 30, 2017
Merged

handle app store url scheme #438

merged 2 commits into from
Dec 30, 2017

Conversation

jdanyow
Copy link
Contributor

@jdanyow jdanyow commented Dec 29, 2017

@leonardosnt
Copy link

leonardosnt commented Dec 29, 2017

Related: #437

Why not use /^[\w-+.]*:/i ? (or ^[a-z][\w-+.]*:) It will handle more use cases.

The scheme, consisting of a sequence of characters beginning with a letter and followed by any combination of letters, digits, plus (+), period (.), or hyphen (-)

https://en.wikipedia.org/wiki/Uniform_Resource_Identifier#Syntax

@hkwid
Copy link

hkwid commented Dec 29, 2017

According to here https://www.iana.org/assignments/uri-schemes/uri-schemes.xhtml
URI schema can include numbers like z39.50.

How about /^[a-z][a-z0-9\+-\.]*:/i /^[a-z][a-z0-9\-+.]*:/i for SCHEME_REGEXP?

(Inside character classes: only ^-]\ are needed to escape
reference: https://stackoverflow.com/questions/399078/what-special-characters-must-be-escaped-in-regular-expressions#answer-400316)

BTW, for integration test, we can add <a href="itms-apps://...">App Store Link</a> to test/integration/html/index.html

...
  <a href="tel:+33636757575">Tel link</a>
  <a href="itms-apps://itunes.apple.com/en/app/awesomeApp/id1234567890">App Store Link</a>
  <script src="index.js"></script>
...

@leonardosnt
Copy link

leonardosnt commented Dec 29, 2017

\w already cover alphanumeric (a-z0-9)

https://regexr.com/3ik67

@hkwid
Copy link

hkwid commented Dec 29, 2017

@leonardosnt I guess \w is included A-Z too. URI schema seems like must be lowercase.

Although schemes are case-insensitive, the canonical form is lowercase and documents that specify schemes must do so with lowercase letters. It is followed by a colon (:). Examples of popular schemes include http(s), ftp, mailto, file, data, and irc. URI schemes should be registered with the Internet Assigned Numbers Authority (IANA), although non-registered schemes are used in practice.
https://en.wikipedia.org/wiki/Uniform_Resource_Identifier#Syntax

@leonardosnt
Copy link

leonardosnt commented Dec 29, 2017

Yeah, you are right. \w also includes underscore, a-z0-9 is better!

Copy link
Member

@devongovett devongovett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated the regex a bit based on suggestions in the comments. thanks!

@devongovett devongovett merged commit 494fafc into parcel-bundler:master Dec 30, 2017
devongovett pushed a commit that referenced this pull request Oct 15, 2018
* handle app store url scheme

* Update scheme regex
devongovett pushed a commit that referenced this pull request Oct 15, 2018
* handle app store url scheme

* Update scheme regex
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

Successfully merging this pull request may close these issues.

None yet

4 participants