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

Autolinking fails with Rails localhost links #93

Open
mokolabs opened this issue Apr 17, 2021 · 2 comments
Open

Autolinking fails with Rails localhost links #93

mokolabs opened this issue Apr 17, 2021 · 2 comments

Comments

@mokolabs
Copy link

mokolabs commented Apr 17, 2021

Rinku does not autolink localhost links used by Rails in :development mode.

irb(main):010:0> Rinku.auto_link("http://localhost:3000/products")
=> "http://localhost:3000/products"

While this URL might be missing a TLD, it's still weird that Rinku skips it. I actually thought Rinku was broken, but it turns out it was just ignoring my localhost links.

As a result, I believe my autolinking code will work in production -- where the URLs generated by the router will inherit the top-level domain from the production site -- but continue to fail in development and testing.

Ideally, for the sake of consistency, it should work in all three environments.

@jrochkind
Copy link

just ran into this too. Any interest in a fix from maintainers? I could try submitting a PR if so.

@jrochkind
Copy link

Oops, looks like this is a dup of #7 , which proposes a configuration fix, if a bit hacky.

Rinku.auto_link(text, nil, nil, nil, Rinku::AUTOLINK_SHORT_DOMAINS)

Does seem to work, although annoying to have to put in all those nils I didn't otherwise need.

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