rstacruz / sinatra-assetpack

Package your assets transparently in Sinatra.
http://ricostacruz.com/sinatra-assetpack/
MIT License
541 stars 97 forks source link

Doesn't like js files with upper case characters #90

Closed lukesmith closed 11 years ago

lukesmith commented 11 years ago

We have a number of javascript files with mixed case names like /app/js/myFile.js. When the assets are generated the files are created in /public/js/ but the file contents of the two files created are empty.

j15e commented 11 years ago

Thanks for reporting, we should add a test for this & fix it. At this moment I have no clue for you about where this bug might come from.

lukesmith commented 11 years ago

The upper case character was red herring and wasn't the real problem (just all files that were blank in the application had upper case characters).

We had routes set up that would 301 redirect the paths with upper case characters to lowercase. It wasn't until I investigated further I found that rake assetpack:build used a Rack::Test::Session to get the files and then write the response out. options#build! performs the get, and in this case would write the empty body response from the 301 to the file rather than follow it.

It's more a problem we need to solve (getting rid of the redirects in the assets), but perhaps options#build! could check the response status for 200 and log any other responses to aid in debugging?

j15e commented 11 years ago

Using a Rack::Test::Session simplify the process but it is indeed causing issues (see also #68). I would like to get rid of this when not necessary but it is not that simple to replace. If you would like to remove the rack session or add a debugging aid I would surely accept a pull request.

j15e commented 11 years ago

I will close this issue as it's kind of a duplicate of #68