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

Static binary assets are not served correctly when they have capital letters in extension #1508

Closed
lonelyelk opened this issue Jul 21, 2015 · 3 comments · May be fixed by Omrisnyk/npm-lockfiles#132

Comments

@lonelyelk
Copy link
Contributor

When serving static binary assets configured with:

files: [
    ...
    {pattern: './fixtures/images/*.jpg', included: false, served: true},
    {pattern: './fixtures/images/*.JPG', included: false, served: true},
    ...
]

Only images with *.jpg extensions are served properly. Capital letters extension shows a 'broken image' icon. This seems to be due to not recognising said image as a binary file. Adding "JPG" to lib/binary-extensions.json or modifying lib/preprocessor.js condition like so:

var thisFileIsBinary = isBinary[path.extname(file.originalPath).toLowerCase()]

Solves the problem.

Not sure how to write a failing test for this to submit a fix.

@dignifiedquire
Copy link
Member

You can add a test here:

it 'should not preprocess binary files', (done) ->
and add a file with an upper case extension here

@lonelyelk
Copy link
Contributor Author

Current master branch has failing tests for me before I even started editing both under node v0.12.6 and iojs v2.3.3:

$ grunt
Running "browserify:client" (browserify) task
>> Bundle static/karma.js created.

Running "test:unit" (test) task

Running "mochaTest:unit" (mochaTest) task


  ․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․
  ․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․

  377 passing (5s)
  3 pending


Running "test:client" (test) task
Running /Users/kruk/dev/karma/bin/karma start test/client/karma.conf.js --single-run --no-auto-watch --reporters=dots
failed to add custom browserify preprocessor
{ [Error: Cannot find module 'karma/lib/preprocessor'] code: 'MODULE_NOT_FOUND' }
22 07 2015 00:05:14.797:INFO [framework.browserify]: 472361 bytes written (0.87 seconds)
22 07 2015 00:05:14.808:INFO [karma]: Karma v0.13.2 server started at http://localhost:9876/
22 07 2015 00:05:14.814:INFO [launcher]: Starting browser Chrome
22 07 2015 00:05:16.157:INFO [Chrome 43.0.2357 (Mac OS X 10.10.4)]: Connected on socket rTnfwhUtnLPRh4G1AAAA with id 19490884
Chrome 43.0.2357 (Mac OS X 10.10.4) ERROR
  Uncaught ReferenceError: require is not defined
  at /Users/kruk/dev/karma/test/client/karma.spec.js:1
Chrome 43.0.2357 (Mac OS X 10.10.4): Executed 0 of 0 ERROR (0.162 secs / 0 secs)
[Error: failed to add custom browserify preprocessor
{ [Error: Cannot find module 'karma/lib/preprocessor'] code: 'MODULE_NOT_FOUND' }]
Fatal error: Client unit tests failed.

@dignifiedquire
Copy link
Member

You'll need to run these commands first https://github.com/karma-runner/karma/blob/master/.travis.yml#L23-L24

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants