scttnlsn / dandelion

Incremental Git repository deployment.
http://scttnlsn.github.io/dandelion
MIT License
738 stars 60 forks source link

ASCII-8BIT to UTF-8 Encoding Error When Transferring PNG #159

Open EpocSquadron opened 7 years ago

EpocSquadron commented 7 years ago

I am encountering an issue when using dandelion in a CI pipeline. Dandelion is running inside a docker container where the Encoding.default_external and Encoding.default_internal have both been set to UTF-8 (for older sass builds to function correctly with icon font definitions). Since implementing that, I started receiving this error when Dandelion attempts to write a png file to the destination server over SFTP.

Any idea why this happens, and the best way to handle?

Here's the error output that occurs during build:

Writing file:  android-chrome-192x192.png
/usr/lib/ruby/2.3.0/delegate.rb:341:in `write': "\x89" from ASCII-8BIT to UTF-8 (Encoding::UndefinedConversionError)
    from /usr/lib/ruby/2.3.0/delegate.rb:341:in `<<'
    from /usr/lib/ruby/2.3.0/delegate.rb:341:in `block in delegating_block'
    from /usr/lib/ruby/gems/2.3.0/gems/dandelion-0.5.0/lib/dandelion/utils.rb:7:in `temp'
    from /usr/lib/ruby/gems/2.3.0/gems/dandelion-0.5.0/lib/dandelion/adapter/sftp.rb:33:in `write'
    from /usr/lib/ruby/gems/2.3.0/gems/dandelion-0.5.0/lib/dandelion/deployer.rb:49:in `deploy_change!'
    from /usr/lib/ruby/gems/2.3.0/gems/dandelion-0.5.0/lib/dandelion/deployer.rb:13:in `block in deploy_changeset!'
    from /usr/lib/ruby/gems/2.3.0/gems/dandelion-0.5.0/lib/dandelion/changeset.rb:32:in `block in each'
    from /usr/lib/ruby/gems/2.3.0/gems/dandelion-0.5.0/lib/dandelion/diff.rb:39:in `block in each'
    from /usr/lib/ruby/gems/2.3.0/gems/dandelion-0.5.0/lib/dandelion/diff.rb:39:in `each'
    from /usr/lib/ruby/gems/2.3.0/gems/dandelion-0.5.0/lib/dandelion/diff.rb:39:in `each'
    from /usr/lib/ruby/gems/2.3.0/gems/dandelion-0.5.0/lib/dandelion/changeset.rb:20:in `each'
    from /usr/lib/ruby/gems/2.3.0/gems/dandelion-0.5.0/lib/dandelion/deployer.rb:9:in `deploy_changeset!'
    from /usr/lib/ruby/gems/2.3.0/gems/dandelion-0.5.0/lib/dandelion/command/deploy.rb:55:in `deploy_changeset!'
    from /usr/lib/ruby/gems/2.3.0/gems/dandelion-0.5.0/lib/dandelion/command/deploy.rb:30:in `execute!'
    from /usr/lib/ruby/gems/2.3.0/gems/dandelion-0.5.0/lib/dandelion/cli.rb:73:in `execute!'
    from /usr/lib/ruby/gems/2.3.0/gems/dandelion-0.5.0/bin/dandelion:8:in `<top (required)>'
    from /usr/sbin/dandelion:23:in `load'
    from /usr/sbin/dandelion:23:in `<main>'
paugarcia commented 6 years ago

I have the same issue!

scttnlsn commented 6 years ago

I haven't really looked into this much but I suspect it's an issue with the Tempfile encoding: https://github.com/scttnlsn/dandelion/blob/master/lib/dandelion/utils.rb#L6

@paugarcia What type of file are you trying to upload when it fails? Is it also an image?