Served Images are corrupted #864

Closed
englercj opened this Issue Dec 18, 2013 · 3 comments

Comments

Projects
None yet
2 participants

On windows when I run my karma grunt task, images that are served via karma are corrupted and thus cause some of my tests to fail.

To see this happen you can clone Pixi.js and checkout the jshint branch:

git clone https://github.com/GoodBoyDigital/pixi.js.git -b jshint

Change the Gruntfile karma task to have singleRun: false so that the runner will not close and you can use Debug mode. After selecting the Debug button, open this URL in a new tab: http://localhost:9876/base/test/textures/bunny.png.

Notice that firefox reports the image contains errors. The actual image is fine, but the served image is broken. Here are my versions:

Windows 7 x64 (also tested on Windows 8 x64)

$ node -v
v0.10.22

$ npm -v
1.3.14

$ npm ls | grep karma
├─┬ karma@0.11.9
├── karma-chrome-launcher@0.1.1
├─┬ karma-coffee-preprocessor@0.1.1
├── karma-firefox-launcher@0.1.2
├── karma-html2js-preprocessor@0.1.0
├── karma-jasmine@0.1.4
├── karma-mocha@0.1.1
├─┬ karma-phantomjs-launcher@0.1.1
├── karma-requirejs@0.2.0
├── karma-script-launcher@0.1.0

This is the last issue blocking me from using karma in pixi, let me know if you need any other information!

I can confirm that this is broken with all versions of karma following 0.11.5
Versions prior to and including 0.11.5 are working as expected.

Well... the breakage happened somewhere in this comparison

76ee886...80637cd

Something do with caching/preprocessing changes.

Narrowed down to this commit 6e31cb2

drkibitz added a commit to drkibitz/karma that referenced this issue Jan 13, 2014

vojtajina added a commit that referenced this issue Feb 5, 2014

fix: serving binary files
For binary files, we can't cache the content as a string (utf8), we need to use a binary buffer.

All the preprocessors are currently implemented to deal with strings, as that makes sense for text files. If we changed preprocessors to deal with buffers then each preprocessor would have to convert the buffer to a string, do the string manipulation and then convert it back to a buffer. I don't think that's worthy as there are no binary preprocessors.

This change disables preprocessing of binary files to avoid weird errors.
It shows warning. If there is a reasonable use case for preprocessing binary files we can figure out something.

Closes #864
Closes #885

vojtajina added a commit that referenced this issue Feb 5, 2014

fix: serving binary files
For binary files, we can't cache the content as a string (utf8), we need to use a binary buffer.

All the preprocessors are currently implemented to deal with strings, as that makes sense for text files. If we changed preprocessors to deal with buffers then each preprocessor would have to convert the buffer to a string, do the string manipulation and then convert it back to a buffer. I don't think that's worthy as there are no binary preprocessors.

This change disables preprocessing of binary files to avoid weird errors.
It shows warning. If there is a reasonable use case for preprocessing binary files we can figure out something.

Closes #864
Closes #885

@vojtajina vojtajina closed this in 8a30cf5 Feb 5, 2014

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