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
image_path without extension #35651
Comments
I hope you meant Rails Version - 5.2.2 |
@gadikotamohan have you precompiled the assets? |
Yes, even asset those files in the asset pipeline as well. |
yes, sorry my bad corrected my post. |
This issue has been automatically marked as stale because it has not been commented on for at least three months. |
To clarify, do you have a file with no extension? Can you say why? If the content type isn’t set correctly, won’t that be an issue for browsers as well? |
@lachlanjc Um.. there need to be consistency of asset url helpers behavior between environment ie; when generating image path in development it is returning correct path but in production mode we get 500 error saying file is not part of asset precompile list. This can re-produced in https://github.com/gadikotamohan/image_test project @lachlanjc I agree that it doesn't make sense to call image_path without valid extension but behavior of image_path need to be consistent by giving same/similar error even for development. |
{
|
This issue has been automatically marked as stale because it has not been commented on for at least three months. |
We just encountered this issue. I understand and agree that paths without extensions should not work. But then it's magically-working-in-development becomes a bug and should be warned at least. |
👍 Please do investigate why there is this discrepancy between environments and open a PR. |
Started to jumping into the code and immediately found that path without an extension should work indeed. Now I'm confused. rails/actionview/lib/action_view/helpers/asset_url_helper.rb Lines 368 to 372 in 55e038c
|
I think this is a very well known bug. @namiwang you should be looking at here @rafaelfranca if In development mode, file extensions can be omitted, which is done by the logic here (find_matching_path_for_extensions): An old PR suggests enfore extension check in sprockets_rails's asset_path. I'd like to send in a PR to sprockets_rails, |
This issue has been automatically marked as stale because it has not been commented on for at least three months. |
Steps to reproduce
<%= image_tag image_path("sample/olivia"), class: 'img img-raised' %>
and run in development and it works without any errors. But if I run in production I would get
F, [2019-03-17T18:36:37.568202 #25602] FATAL -- : [1c06c250-3a3e-46f4-8dbb-10686d28d26f] ActionView::Template::Error (The asset "sample/olivia" is not present in the asset pipeline.):
Expected behavior
Actual behavior
System configuration
Ruby version: 2.5.3
Rails version: 5.2.2
The text was updated successfully, but these errors were encountered: