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

Jar file returns with invalid length (Corrupted jar file returned) #136

Closed
shuk opened this issue Oct 3, 2014 · 3 comments
Closed

Jar file returns with invalid length (Corrupted jar file returned) #136

shuk opened this issue Oct 3, 2014 · 3 comments

Comments

@shuk
Copy link

shuk commented Oct 3, 2014

Some *.jar files returns with incorrect length so returned *.jar files are corrupted.

E.g. I hosted httpcore-4.2.1.jar as static content. The actual size is 223374 bytes http://central.maven.org/maven2/org/apache/httpcomponents/httpcore/4.2.1/httpcore-4.2.1.jar

But "grunt connect" returned httpcore-4.2.1.jar file as file with length 389046 bytes (corrupted file)!

On my local computer the jar file was located here: \web\plugins\scan-tool\lib\resteasy\httpcore-4.2.1.jar

And for hosting I used following code:

connect: {
            options: {
                port: 9000,
                // Change this to '0.0.0.0' to access the server from outside.
                hostname: 'localhost',
                livereload: 35729
            },
            livereload: {
                options: {
                    open: true,
                    middleware: function (connect) {
                        return [
                            connect.static('web')
                        ];
                    }
                }
            }
        },
@misja-alma
Copy link

This looks like the issue I'm having (issue #145). Check the file encoding of the corrupted jar. In my case it was updated to UTF-8, which explains why the file has grown in size (and why it has become corrupted).

@koolshams
Copy link

Looks like this is an issue related to connect-livereload plugin.

this plugin will try to encode response content as a string, to see whether it is html content. if not it sends the encoded string as response which will corrupt the binary files.

intesso/connect-livereload#39

As a workaround find connect-livereload/index.js in node_modules find the following function

function livereload(req, res, next) {

Add some logic so that your URL is not checked. Also you can add .jar pattern in ignore list.

But there is no correct solution as there are lot more other this depends on this feature.

@XhmikosR
Copy link
Member

XhmikosR commented Sep 9, 2018

Seems an upstream issue.

@XhmikosR XhmikosR closed this as completed Sep 9, 2018
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

4 participants