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

Files with + characted are not served from asset line. #34847

Closed
gorn opened this issue Jan 3, 2019 · 3 comments
Closed

Files with + characted are not served from asset line. #34847

gorn opened this issue Jan 3, 2019 · 3 comments

Comments

@gorn
Copy link

gorn commented Jan 3, 2019

Steps to reproduce

In development mode put a file at /assets/images/pin-m+.png

Expected behavior

File is served at http://railsapp.server.com/assets/pin-m+.png

Actual behavior

Error No route matches [GET] "/assets/pin-m+.png" occurs

System configuration

Rails version: 5.1.6.1

Ruby version: 2.5.1

@gorn
Copy link
Author

gorn commented Jan 3, 2019

It looks simillar to #9788

@y-yagi
Copy link
Member

y-yagi commented Jan 3, 2019

This is an issue of sprockets.
The sprockets use Rack::Utils.unescape for an escape path and Rack::Utils.unescape use URI.decode_www_form_component. So + converted to space.
https://github.com/rails/sprockets/blob/e25e0f5f993cbdff685a33540bbee927a4567177/lib/sprockets/server.rb#L38
https://github.com/rack/rack/blob/690f2276673b00935fffe8961431b462dfa65346/lib/rack/utils.rb#L52-L54

In my understanding, the reason for the escape is rack's specification. Please see rack/rack#265 for more details.
Anyway, this is not Rails's issue. So I close. Thanks.

@y-yagi y-yagi closed this as completed Jan 3, 2019
@gorn
Copy link
Author

gorn commented Apr 29, 2019

This is completele against the principle od least surprise, so it needs to be at least documented.

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