jekyll-remote-theme icon indicating copy to clipboard operation
jekyll-remote-theme copied to clipboard

URL to download with branch specified is case-sensitive which is not respected

Open KyleK1782 opened this issue 3 years ago • 2 comments

Describe the Bug

When specifying a branch to use, the link to download the zip will fail as GitHub expects the branch name to be case-sensitive in the URL.

It attempts to download the link https://codeload.github.com/kylek1782/minima/zip/kylek1782-discord-social which is a 404. However, https://codeload.github.com/kylek1782/minima/zip/KyleK1782-discord-social works as the branch has capitals in its name.

My branch on GitHub: https://github.com/KyleK1782/minima/tree/KyleK1782-discord-social

Steps to Reproduce the Behaviour

  1. Change the remote_theme setting to
remote_theme: "kylek1782/minima@KyleK1782-discord-social"
  1. Run bundle exec jekyll serve

Expected Behaviour

The URL to download should respect the case-sensitive nature of branch names when generating the URL to download the zip file.

Additional Context

Error output:

Configuration file: /mnt/c/Users/fredg/Developer/kyleknobloch-ca-website/_config.yml
To use retry middleware with Faraday v2.0+, install `faraday-retry` gem
            Source: /mnt/c/Users/fredg/Developer/kyleknobloch-ca-website
       Destination: /mnt/c/Users/fredg/Developer/kyleknobloch-ca-website/_site
 Incremental build: disabled. Enable with --incremental
      Generating...
      Remote Theme: Using theme kylek1782/minima
jekyll 3.9.2 | Error:  404 - Not Found - Loading URL: https://codeload.github.com/kylek1782/minima/zip/kylek1782-discord-social
Traceback (most recent call last):
        48: from /home/fredg/gems/bin/bundle:23:in `<main>'
        47: from /home/fredg/gems/bin/bundle:23:in `load'
        46: from /home/fredg/gems/gems/bundler-2.3.22/exe/bundle:36:in `<top (required)>'
        45: from /home/fredg/gems/gems/bundler-2.3.22/lib/bundler/friendly_errors.rb:120:in `with_friendly_errors'
        44: from /home/fredg/gems/gems/bundler-2.3.22/exe/bundle:48:in `block in <top (required)>'
        43: from /home/fredg/gems/gems/bundler-2.3.22/lib/bundler/cli.rb:25:in `start'
        42: from /home/fredg/gems/gems/bundler-2.3.22/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
        41: from /home/fredg/gems/gems/bundler-2.3.22/lib/bundler/cli.rb:31:in `dispatch'
        40: from /home/fredg/gems/gems/bundler-2.3.22/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
        39: from /home/fredg/gems/gems/bundler-2.3.22/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
        38: from /home/fredg/gems/gems/bundler-2.3.22/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
        37: from /home/fredg/gems/gems/bundler-2.3.22/lib/bundler/cli.rb:486:in `exec'
        36: from /home/fredg/gems/gems/bundler-2.3.22/lib/bundler/cli/exec.rb:23:in `run'
        35: from /home/fredg/gems/gems/bundler-2.3.22/lib/bundler/cli/exec.rb:58:in `kernel_load'
        34: from /home/fredg/gems/gems/bundler-2.3.22/lib/bundler/cli/exec.rb:58:in `load'
        33: from /home/fredg/gems/bin/jekyll:23:in `<top (required)>'
        32: from /home/fredg/gems/bin/jekyll:23:in `load'
        31: from /home/fredg/gems/gems/jekyll-3.9.2/exe/jekyll:15:in `<top (required)>'
        30: from /home/fredg/gems/gems/mercenary-0.3.6/lib/mercenary.rb:19:in `program'
        29: from /home/fredg/gems/gems/mercenary-0.3.6/lib/mercenary/program.rb:42:in `go'
        28: from /home/fredg/gems/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `execute'
        27: from /home/fredg/gems/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `each'
        26: from /home/fredg/gems/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `block in execute'
        25: from /home/fredg/gems/gems/jekyll-3.9.2/lib/jekyll/commands/serve.rb:75:in `block (2 levels) in init_with_program'
        24: from /home/fredg/gems/gems/jekyll-3.9.2/lib/jekyll/commands/serve.rb:93:in `start'
        23: from /home/fredg/gems/gems/jekyll-3.9.2/lib/jekyll/commands/serve.rb:93:in `each'
        22: from /home/fredg/gems/gems/jekyll-3.9.2/lib/jekyll/commands/serve.rb:93:in `block in start'
        21: from /home/fredg/gems/gems/jekyll-3.9.2/lib/jekyll/commands/build.rb:36:in `process'
        20: from /home/fredg/gems/gems/jekyll-3.9.2/lib/jekyll/commands/build.rb:65:in `build'
        19: from /home/fredg/gems/gems/jekyll-3.9.2/lib/jekyll/command.rb:28:in `process_site'
        18: from /home/fredg/gems/gems/jekyll-3.9.2/lib/jekyll/site.rb:68:in `process'
        17: from /home/fredg/gems/gems/jekyll-3.9.2/lib/jekyll/site.rb:105:in `reset'
        16: from /home/fredg/gems/gems/jekyll-3.9.2/lib/jekyll/hooks.rb:102:in `trigger'
        15: from /home/fredg/gems/gems/jekyll-3.9.2/lib/jekyll/hooks.rb:102:in `each'
        14: from /home/fredg/gems/gems/jekyll-3.9.2/lib/jekyll/hooks.rb:103:in `block in trigger'
        13: from /home/fredg/gems/gems/jekyll-remote-theme-0.4.3/lib/jekyll-remote-theme.rb:33:in `block in <top (required)>'
        12: from /home/fredg/gems/gems/jekyll-remote-theme-0.4.3/lib/jekyll-remote-theme.rb:27:in `init'
        11: from /home/fredg/gems/gems/jekyll-remote-theme-0.4.3/lib/jekyll-remote-theme/munger.rb:24:in `munge!'
        10: from /home/fredg/gems/gems/jekyll-remote-theme-0.4.3/lib/jekyll-remote-theme/downloader.rb:24:in `run'
         9: from /home/fredg/gems/gems/jekyll-remote-theme-0.4.3/lib/jekyll-remote-theme/downloader.rb:42:in `download'
         8: from /usr/lib/ruby/2.7.0/net/http.rb:606:in `start'
         7: from /usr/lib/ruby/2.7.0/net/http.rb:933:in `start'
         6: from /home/fredg/gems/gems/jekyll-remote-theme-0.4.3/lib/jekyll-remote-theme/downloader.rb:43:in `block in download'
         5: from /usr/lib/ruby/2.7.0/net/http.rb:1492:in `request'
         4: from /usr/lib/ruby/2.7.0/net/http.rb:1536:in `transport_request'
         3: from /usr/lib/ruby/2.7.0/net/http/response.rb:167:in `reading_body'
         2: from /usr/lib/ruby/2.7.0/net/http.rb:1537:in `block in transport_request'
         1: from /home/fredg/gems/gems/jekyll-remote-theme-0.4.3/lib/jekyll-remote-theme/downloader.rb:44:in `block (2 levels) in download'
/home/fredg/gems/gems/jekyll-remote-theme-0.4.3/lib/jekyll-remote-theme/downloader.rb:67:in `raise_unless_sucess': 404 - Not Found - Loading URL: https://codeload.github.com/kylek1782/minima/zip/kylek1782-discord-social (Jekyll::Rem
oteTheme::DownloadError)

KyleK1782 avatar Sep 11 '22 16:09 KyleK1782

If you're able to submit a pull request, removing the downcase call from https://github.com/benbalter/jekyll-remote-theme/blob/master/lib/jekyll-remote-theme/theme.rb#L22, should fix this (although I don't know if it will have other unintended consequences for which the other parts of the theme name need to be case insensitive.

benbalter avatar Sep 12 '22 18:09 benbalter

I don't know much Ruby but I'll give this a shot when I have some time. I'll try and make it so that it will still lowercase everything else but the git-ref part after the @.

Goal: remote_theme: "KyleK1782/minima@KyleK1782-discord-social" will become remote_theme: "kylek1782/minima@KyleK1782-discord-social"

KyleK1782 avatar Sep 12 '22 19:09 KyleK1782