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

Incompatibility with Rails 5.2 ActiveStorage #33

Open
CodingAnarchy opened this issue May 23, 2018 · 3 comments
Open

Incompatibility with Rails 5.2 ActiveStorage #33

CodingAnarchy opened this issue May 23, 2018 · 3 comments

Comments

@CodingAnarchy
Copy link

CodingAnarchy commented May 23, 2018

ActiveStorage uses signed_blob_id parameters that are case-sensitive. At present, this is incompatible with the route_downcaser gem. However, the downcasing of routes in general is a useful concept. If there would be any way to exempt these ActiveStorage generated urls (they are typically of the form /rails/active_storage/... with the built-in routing in Rails), that would really help me out.

@koppen
Copy link
Member

koppen commented May 25, 2018

Uh, that sucks, thanks for reporting. I wonder if it'd be possible to configure your way out of this?

Something like

  config.exclude_patterns = [
    /rails\/active_storage\//i,
  ]

should prevent route_downcaser from modifying URLs in the /rails/active_storage/ paths.

@lostapathy
Copy link

I just spent quite a while trying to track down this same issue myself. The example by @koppen does indeed work around the issue. Is there any strong reason we couldn't make that the default and save others the trouble of discovering it?

FWIW, I took a go at ActiveStorage about a year ago and gave up thinking it was broken at the time. I was quite surprised this was the fix! I'm not trying to place blame at all, but I think there's a strong argument for making route_downcaser work with ActiveStorage out of the box.

@koppen
Copy link
Member

koppen commented Nov 15, 2018

Cool, thanks for verifying the fix @lostapathy.

route_downcaser tries to assume as little as possible about your environment or application as possible, and it's not a Rails-only gem, so adding exceptions for Rails-specific functionality or other third party behaviour seems out of scope.

If we do want to add something, it should probably be some opt-in thing, perhaps a configuration option (config.active_storage = true) or the like?

That said, at the very least we should be able to document it, perhaps as a special note in the section about exclude_patterns. I'll be happy to look at any pull requests with improvements for this.

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

3 participants