all image assets downloaded are corrupted #24

hayesy opened this Issue Feb 9, 2013 · 13 comments

4 participants


ruby 1.9.3
downloaded latest at Git
on Windows 8.

after setup ran
theme download

downloads everything but images are corrupted.......

Shopify member

Can you post the output you saw, the output of ruby -v and gem list shopify_theme from the command line.

I've never tried it on windows, but wouldn't think there would be differences.


this is my first experience using ruby...

output of ruby -v:
ruby 1.9.3p374 (2013-01-15) [i386-mingw32]

output of gem list shopify_theme:
*** LOCAL GEMS ***

shopify_theme (0.0.7)

There was no error, I simply ran:
theme download

everything seems to go fine and in fact all of the text files, directory structure, filenames are perfect, however all images that are downloaded are corrupted - i didn't notice until I tried to view one.

Thanks for your help.



Also thanks so much for this tool. I was very excited when I thought it was working because I am in the middle of creating a custom theme. Hopefully I will be able to use it...



sorry for all the posts -

I just realized some of the jpg's are ok. but most are corrupt, including a photoshop file.

I wasn't sure if also wanted this:

C:\ModernNature>theme download
Downloaded: assets/1.jpg
Downloaded: assets/10.jpg
Downloaded: assets/10_cap.jpg
Downloaded: assets/1_cap.jpg
Downloaded: assets/2.jpg
Downloaded: assets/2_cap.jpg
Downloaded: assets/3.jpg
Downloaded: assets/3_cap.jpg
Downloaded: assets/4.jpg
Downloaded: assets/4_cap.jpg
Downloaded: assets/5.jpg
Downloaded: assets/5_cap.jpg
Downloaded: assets/6.jpg
Downloaded: assets/6_cap.jpg
Downloaded: assets/7.jpg
Downloaded: assets/7_cap.jpg
Downloaded: assets/8.jpg
Downloaded: assets/8_cap.jpg
Downloaded: assets/9.jpg
Downloaded: assets/9_cap.jpg
Downloaded: assets/add-medium.png
Downloaded: assets/add-sml.png
Downloaded: assets/address-sml.png
Downloaded: assets/BebasNeue-webfont.eot
Downloaded: assets/BebasNeue-webfont.svg
Downloaded: assets/BebasNeue-webfont.ttf
Downloaded: assets/BebasNeue-webfont.woff
Downloaded: assets/blank.gif
Downloaded: assets/btn-small-depth.png
Downloaded: assets/carousel-item-1.jpg
Downloaded: assets/carousel-item-2.jpg
Downloaded: assets/carousel-item-3.jpg
Downloaded: assets/carousel-item-4.jpg
Downloaded: assets/carousel-item-5.jpg
Downloaded: assets/carousel-item-6.jpg
Downloaded: assets/cart-icons.png
Downloaded: assets/cc-amex.png
Downloaded: assets/cc-cirrus.png
Downloaded: assets/cc-discover.png
Downloaded: assets/cc-google.png
Downloaded: assets/cc-maestro.png
Downloaded: assets/cc-mastercard.png
Downloaded: assets/cc-paypal.png
Downloaded: assets/cc-visa.png
Downloaded: assets/checkout.css.liquid
Downloaded: assets/delete-sml.png
Downloaded: assets/diagonal-black.png
Downloaded: assets/diagonal-light-grey.png
Downloaded: assets/diagonal-white.png
Downloaded: assets/edit-sml.png
Downloaded: assets/enhance.jquery.js
Downloaded: assets/fancybox-x.png
Downloaded: assets/fancybox-y.png
Downloaded: assets/fancybox.png
Downloaded: assets/fancy_close.png
Downloaded: assets/fancy_loading.png
Downloaded: assets/fancy_nav_left.png
Downloaded: assets/fancy_nav_right.png
Downloaded: assets/fancy_shadow_e.png
Downloaded: assets/fancy_shadow_n.png
Downloaded: assets/fancy_shadow_ne.png
Downloaded: assets/fancy_shadow_nw.png
Downloaded: assets/fancy_shadow_s.png
Downloaded: assets/fancy_shadow_se.png
Downloaded: assets/fancy_shadow_sw.png
Downloaded: assets/fancy_shadow_w.png
Downloaded: assets/fancy_title_left.png
Downloaded: assets/fancy_title_main.png
Downloaded: assets/fancy_title_over.png
Downloaded: assets/fancy_title_right.png
Downloaded: assets/hoverintent.jquery.js
Downloaded: assets/icon-loading.gif
Downloaded: assets/icon-search.png
Downloaded: assets/jquery.easing-1.3.pack.js
Downloaded: assets/jquery.fancybox-1.3.4.css
Downloaded: assets/jquery.fancybox-1.3.4.js
Downloaded: assets/jquery.fancybox-1.3.4.pack.js
Downloaded: assets/jquery.imgready.js.liquid
Downloaded: assets/jquery.mousewheel-3.0.4.pack.js
Downloaded: assets/
Downloaded: assets/jquery.tweet.js
Downloaded: assets/jquery.wmuSlider.js
Downloaded: assets/logo.png
Downloaded: assets/main_1.jpg
Downloaded: assets/main_2.jpg
Downloaded: assets/main_3.jpg
Downloaded: assets/main_4.jpg
Downloaded: assets/main_5.jpg
Downloaded: assets/main_6.jpg
Downloaded: assets/main_7.jpg
Downloaded: assets/main_8.jpg
Downloaded: assets/main_9.jpg
Downloaded: assets/main_logo.jpg
Downloaded: assets/modernizr.js
Downloaded: assets/mos_fix.css
Downloaded: assets/nav_bar.jpg
Downloaded: assets/newstyle_clear.css.liquid
Downloaded: assets/no-products-post-it.png
Downloaded: assets/placeholder-product.png
Downloaded: assets/radiance.js
Downloaded: assets/slider_close.jpg
Downloaded: assets/slider_cover.jpg
Downloaded: assets/social-media.png
Downloaded: assets/social-media.psd
Downloaded: assets/social_bar.png
Downloaded: assets/spacer.gif
Downloaded: assets/sprites_black.png
Downloaded: assets/style.css.liquid
Downloaded: assets/swap.js
Downloaded: assets/table-header-depth.png
Downloaded: assets/variant-sky-bg-grey.jpg
Downloaded: assets/variant-sky-bg-magenta.jpg
Downloaded: assets/variant-sky-bg.jpg
Downloaded: assets/variant-slate-bg-cool.jpg
Downloaded: assets/variant-slate-bg-silver.jpg
Downloaded: assets/variant-slate-bg-warm.jpg
Downloaded: assets/variant-wood-bg-oak.jpg
Downloaded: assets/variant-yellow-bg.jpg
Downloaded: config/settings.html
Downloaded: config/settings_data.json
Downloaded: layout/theme.liquid
Downloaded: snippets/carousel.liquid
Downloaded: snippets/col-widgets.liquid
Downloaded: snippets/collection-grid-item.liquid
Downloaded: snippets/collection-listing.liquid
Downloaded: snippets/comment-template.liquid
Downloaded: snippets/fb-open-graph.liquid
Downloaded: snippets/if-shop-has-no-products.liquid
Downloaded: snippets/pagination.liquid
Downloaded: snippets/product-grid-item.liquid
Downloaded: snippets/related-products.liquid
Downloaded: snippets/social-sharing.liquid
Downloaded: snippets/widget-linklist.liquid
Downloaded: templates/404.liquid
Downloaded: templates/article.liquid
Downloaded: templates/blog.liquid
Downloaded: templates/cart.liquid
Downloaded: templates/collection.liquid
Downloaded: templates/customers/account.liquid
Downloaded: templates/customers/activate_account.liquid
Downloaded: templates/customers/addresses.liquid
Downloaded: templates/customers/login.liquid
Downloaded: templates/customers/order.liquid
Downloaded: templates/customers/register.liquid
Downloaded: templates/customers/reset_password.liquid
Downloaded: templates/index.index_BAK.liquid
Downloaded: templates/index.liquid
Downloaded: templates/
Downloaded: templates/page.liquid
Downloaded: templates/product.liquid
Downloaded: templates/search.liquid


Shopify member

Can you export the theme from the web and make sure that's okay, if it is email it to me and I'll try to debug it.

Shopify member

I tested on my machine with your theme and didn't have any issues. I took the good theme you sent, uploaded it to my shop then ran theme download and tested the images and they were all fine (tested ones that were corrupt from your other attachement).

The only thing I can think of is you're on Windows, can you try it on a linux or osx machine? I've never heard of people getting corrupt images on Windows.


Another Windows user here - I have the same issue on Windows 7 Pro. Same computer & same theme works without a problem on OS X. I'm using latest Ruby (2.0.0).

Let me know if there are any specifics I can provide to help with this issue.


Suggested fix:

in cli.rb - replace with below:

def download_asset(key)
  asset = ShopifyTheme.get_asset(key)
  if asset['value']
    # For CRLF line endings
    content = asset['value'].gsub("\r", "")
    format = "w"
  elsif asset['attachment']
    content = Base64.decode64(asset['attachment'])
    format = "w+b"

  FileUtils.mkdir_p(File.dirname(key)), format) {|f| f.write content} if content

Thank you!!! I won't be able to try this for a few days but I am happy for a possible solution..


Also, fix send_asset as follows:

  if ShopifyTheme.is_binary_data?(content) || BINARY_EXTENSIONS.include?(File.extname(asset).gsub('.',''))
    content = open(asset, "rb") {|io| }
    data.merge!(:attachment => Base64.encode64(content))
    data.merge!(:value => content)
Shopify member

Did someone want to create a pull request for this stuff and I'll get it merged in.

@jduff jduff closed this in ef5f22e Jun 2, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment