question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Turbo will not navigate to URLs that have a `.` in the pathname

See original GitHub issue

https://github.com/hotwired/turbo/blob/98cdc4037788f078a741c7fb50412db0101bcb97/src/core/url.ts#L27-L29

It looks like that this behavior is intended, guessing it prevents Turbo from running when users are downloading a file. The problem is that routes with . are valid in Rails routes, so, if you tried to navigate to routes like:

Turbo won’t even try to navigate to them.

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:4
  • Comments:17 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
f6pcommented, Aug 10, 2022

@2called-chaos It doesn’t. I think that this is a separate bug/issue. Right now its value could be true or false but I think it should accept 3 values false - always disable Turbo, default - run default check (what true does right now) and true - always force Turbo visit (not what it does currently). It probably would be what one would expect from it without studying internals.

I have similar project where I have to pass file path as a parameter in a host/controller/path/to/some/file.txt format and what I do is I modify is isHTML to always return true and manually disable likns that aren’t navigable with data-trubo=false.

Cheers 🍷

1reaction
f6pcommented, Jun 27, 2022

Or even simpler than that. Pass basic object to isVisitable with attributes reassigned from URL and some extras (extension etc).

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I parse a URL into hostname and path in javascript?
The first argument is a relative or absolute URL; if it's relative, then you need to specify the second argument (the base URL)....
Read more >
URL.pathname - Web APIs - MDN Web Docs
The pathname property of the URL interface represents a location in a hierarchical structure. It is a string constructed from a list of...
Read more >
Lazy-loaded frame - Turbo Reference
src accepts a URL or path value that controls navigation of the element · loading has two valid enumerated values: “eager” and “lazy”....
Read more >
Routing - Remix
When there is no child route to render, we render the index route. Consider the URL example.com/sales . If our app didn't have...
Read more >
Client Component Hooks: usePathname - Next.js beta docs
'use client'; import { usePathname } from 'next/navigation'; export default function Page() { // When URL is /blog/hello, pathname = '/blog/hello' // When ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found