Comments (19)
Thanks for your help!
New install will load fixed uc.micro
, but i released a new version with bumped dependencies for sure.
from linkify-it.
I've asked guys from disapora & npm to inspect this change for sure. If they will not find any edge cases, i'll do "official" release.
from linkify-it.
Hm... that's really strange. There should be no such regexes and fuzzyLink: true
should not be related. We cared about such situations.
See the link above, can't reproduce hang you have. Could you prepare test repo with minimal example?
from linkify-it.
Oh shoot I wanted to say that I managed to avoid the issue by setting fuzzyLink
to false
. I wrote my issue a little took quickly π
I added a PoC.js file in the gist linked earlier https://gist.github.com/eramdam/d743452c916e90ff7b42720f4384088e
Try to switch fuzzyLink
to false/true to see. Running node v6.2.0
from linkify-it.
Hm... still can't reproduce, checked in node 6 latest and node 4 latest. Your gist has typos, here is one i used after fixes https://gist.github.com/puzrin/b573e94015f11c71e048e52a42b6db43
Difference with fuzzy on/off is almost not visible. Could you clarify your example?
from linkify-it.
The two last lines on the string in PoC.js were actually very important because they are the one that triggers the issue for me. Specifically the abcd://abcdeghi.com
part.
const str = 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nπ‘π‘π‘π‘π‘π‘π‘π‘π‘π‘π‘π‘π‘π‘π‘π‘π‘π‘π‘π‘π‘π‘π‘π‘π‘π‘π‘π‘π‘π‘π‘π‘π‘π‘π‘Lorem ipsum dolor sitππππππππππππππππππππππLorem ipsum dolor sit amet, consecteturππππππππππAAUID: 234567876543456 Sent via: abcd://abcdeghi.com';
const res = BaseFunc(str);
I recorded the situation if that might help https://asciinema.org/a/57ojqri3hvpuly7brol6izt1w
from linkify-it.
More details:
With fuzzyLink: true
- The string
Lorem ipsum dolor sit amet, consecteturππππππππππAAUID: 234567876543456 Sent via: abcd://abcdeghi.com
is processed finely (~20ms) - The string
ππππππππππππππππππππππLorem ipsum dolor sit amet, consecteturππππππππππAAUID: 234567876543456 Sent via: abcd://abcdeghi.com
starts to slow down the process where it takes ~430ms to process it - The string
π‘π‘π‘π‘π‘π‘π‘π‘π‘π‘π‘π‘π‘π‘π‘π‘π‘π‘π‘π‘π‘π‘π‘π‘π‘Lorem ipsum dolor sitππππππππππππππππππππππLorem ipsum dolor sit amet, consecteturππππππππππAAUID: 234567876543456 Sent via: abcd://abcdeghi.com
starts to be pretty long to process (~3.7sec) and it gets worse the more emoji get added to the string.
And when I set fuzzyLink
to false
everything runs fine in 15ms.
from linkify-it.
Reproduced :(. Pattern is 'π‘π‘π‘π‘π‘π‘π‘π‘π‘π‘π‘π‘π‘π‘π‘π‘π‘π‘π‘π‘π‘π‘π‘π‘π‘π‘π‘π‘π‘π‘π‘π‘π‘π‘π‘ .com'
.com
needed to pass simple check that fuzzy link may exist. @rlidwka take a look please
from linkify-it.
This pattern also crashes online demo.
from linkify-it.
Possible workarounds:
- Reoptimize
uc.micro
regex to useu
flags when available. Problem - may be can fix node (not sure), but still sucks with old browsers.- for old browsers we can drop astral matches before TLDs in fuzzy links.
- Split fuzzy search to have strong start (or end) points:
- search
.TLD/valid_path
. In this case pattern.TLD
is simple & unique enougth to limit possible scans. - validate matching prefix before
.TLD
. In this case$
can help. If not - we can write back-direction scanner.
- search
from linkify-it.
Awesome! Glad to help, and thanks for the insanely fast response π
from linkify-it.
Seems you've been interested in #26. Do you have stats about links with <
& >
? I'm not sure that < >
comes in pairs like (...)
and [...]
.
I could suggest such kludge: if http(s)://
is prepended with <
, then drop in found link everything after >
. But not sure how safe is it.
from linkify-it.
@puzrin it's "common" in text version of automatic emails so yes >
and <
come in pair. The tricky thing is not to match the trailing >
as part of the URL, sounds pretty safe to me since these are characters that are supposed to be in URLs AFAIK.
from linkify-it.
So, you suggest to drop >
only if it is the last character in link and <
come before http://
?
Under "pairs" i meaned location inside links ~ like http://example.com/foo_bar_(wiki)
from linkify-it.
May be you have some stat when <
or >
can be used in link? Need examples to meditate over :)
from linkify-it.
I don't have specific statistics, but it's used A LOT for emails also. And no I don't think >
and <
are supposed to be contained inside a valid URL:
given this <http://domain.com/foo_bar_(wiki)>
then the parsed URL should be http://domain.com/foo_bar_(wiki)
.
Here are some examples I can get from the top of my head:
<http://domain.com>
<[email protected]>
from linkify-it.
Try version from master. I don't know is it correct c502c8b.
<
& >
were disabled in links, including path & query.
from linkify-it.
Will try that asap
from linkify-it.
@puzrin I tried and it seems good to me, works as expected! π π
from linkify-it.
Related Issues (20)
- url not matched when it contains `...:` HOT 3
- options to escape a particular link? HOT 1
- Schema keys are case-insensitive, but only in one direction? HOT 3
- Add .app TLD to tlds_default HOT 6
- Parsed incorrectly when the link ends with the closing parenthesis in Chinese
- Colon after URL is included into URL, when using markdown-it with `linkify: true` HOT 1
- How to return 0 in the validate function ? HOT 1
- Links preceded by emojis are not rendered
- Router admin login IP disclosed in source code HOT 1
- Error: Namespace 'LinkifyIt' has no exported member 'LinkifyIt' HOT 3
- Change default protocol in fuzzyLink option HOT 2
- Doesn't seem to support domain-specific rules HOT 1
- Inconsistent link recognition when wrapped within html element HOT 2
- Matching URL's that contain spaces %20 HOT 2
- url with !! is not detected correctly HOT 1
- Email links followed by a hyphen are not detected HOT 5
- URLs with period and parantheses stop before closing parentheses HOT 3
- Links with "_" in the domain name are not regarded as links HOT 2
- Links that are containing '?' are not detected HOT 1
- Links with slashes capturing trailing semicolons HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from linkify-it.