jekyll-redirect-from 和 github-metadata gems 的组合抛出错误

Combination of jekyll-redirect-from and github-metadata gems throwing errors

我正在开发一个 Jekyll 网站,该网站使用 jekyll-redirect-from 将旧页面 URL 重定向到新的对应页面。它正常构建良好,但是当我也将 GitHub-metadata gem 添加到我的 gem 文件并尝试构建我的站点时,我收到一条非常无用的消息:

> bundle exec jekyll build --trace
Configuration file: <site folder>/_config.yml
            Source: <site folder>
       Destination: <site folder>/_site
      Generating...
d:/tools/Ruby21-x64/lib/ruby/gems/2.1.0/gems/jekyll-redirect-from-0.8.0/lib/jekyll-redirect-from/redirector.rb:67:in `join': no implicit conversion of Jekyll::GitHubMetadata::Value into String (TypeError)
        from d:/tools/Ruby21-x64/lib/ruby/gems/2.1.0/gems/jekyll-redirect-from-0.8.0/lib/jekyll-redirect-from/redirector.rb:67:in `redirect_url'
        from d:/tools/Ruby21-x64/lib/ruby/gems/2.1.0/gems/jekyll-redirect-from-0.8.0/lib/jekyll-redirect-from/redirector.rb:19:in `block (2 levels) in generate_alt_urls'
        from d:/tools/Ruby21-x64/lib/ruby/gems/2.1.0/gems/jekyll-redirect-from-0.8.0/lib/jekyll-redirect-from/redirector.rb:15:in `each'
        from d:/tools/Ruby21-x64/lib/ruby/gems/2.1.0/gems/jekyll-redirect-from-0.8.0/lib/jekyll-redirect-from/redirector.rb:15:in `block in generate_alt_urls'
        from d:/tools/Ruby21-x64/lib/ruby/gems/2.1.0/gems/jekyll-redirect-from-0.8.0/lib/jekyll-redirect-from/redirector.rb:13:in `each'
        from d:/tools/Ruby21-x64/lib/ruby/gems/2.1.0/gems/jekyll-redirect-from-0.8.0/lib/jekyll-redirect-from/redirector.rb:13:in `generate_alt_urls'
        from d:/tools/Ruby21-x64/lib/ruby/gems/2.1.0/gems/jekyll-redirect-from-0.8.0/lib/jekyll-redirect-from/redirector.rb:8:in `generate'
        from d:/tools/Ruby21-x64/lib/ruby/gems/2.1.0/gems/jekyll-2.4.0/lib/jekyll/site.rb:251:in `block in generate'
        from d:/tools/Ruby21-x64/lib/ruby/gems/2.1.0/gems/jekyll-2.4.0/lib/jekyll/site.rb:250:in `each'
        from d:/tools/Ruby21-x64/lib/ruby/gems/2.1.0/gems/jekyll-2.4.0/lib/jekyll/site.rb:250:in `generate'
        from d:/tools/Ruby21-x64/lib/ruby/gems/2.1.0/gems/jekyll-2.4.0/lib/jekyll/site.rb:45:in `process'
        from d:/tools/Ruby21-x64/lib/ruby/gems/2.1.0/gems/jekyll-2.4.0/lib/jekyll/command.rb:28:in `process_site'
        from d:/tools/Ruby21-x64/lib/ruby/gems/2.1.0/gems/jekyll-2.4.0/lib/jekyll/commands/build.rb:55:in `build'
        from d:/tools/Ruby21-x64/lib/ruby/gems/2.1.0/gems/jekyll-2.4.0/lib/jekyll/commands/build.rb:33:in `process'
        from d:/tools/Ruby21-x64/lib/ruby/gems/2.1.0/gems/jekyll-2.4.0/lib/jekyll/commands/build.rb:17:in `block (2 levels) in init_with_program'
        from d:/tools/Ruby21-x64/lib/ruby/gems/2.1.0/gems/mercenary-0.3.5/lib/mercenary/command.rb:220:in `call'
        from d:/tools/Ruby21-x64/lib/ruby/gems/2.1.0/gems/mercenary-0.3.5/lib/mercenary/command.rb:220:in `block in execute'
        from d:/tools/Ruby21-x64/lib/ruby/gems/2.1.0/gems/mercenary-0.3.5/lib/mercenary/command.rb:220:in `each'
        from d:/tools/Ruby21-x64/lib/ruby/gems/2.1.0/gems/mercenary-0.3.5/lib/mercenary/command.rb:220:in `execute'
        from d:/tools/Ruby21-x64/lib/ruby/gems/2.1.0/gems/mercenary-0.3.5/lib/mercenary/program.rb:42:in `go'
        from d:/tools/Ruby21-x64/lib/ruby/gems/2.1.0/gems/mercenary-0.3.5/lib/mercenary.rb:19:in `program'
        from d:/tools/Ruby21-x64/lib/ruby/gems/2.1.0/gems/jekyll-2.4.0/bin/jekyll:18:in `<top (required)>'
        from d:/tools/Ruby21-x64/bin/jekyll:23:in `load'
        from d:/tools/Ruby21-x64/bin/jekyll:23:in `<main>'

重要的部分是 no implicit conversion of Jekyll::GitHubMetadata::Value into String (TypeError) 部分。元数据 gem 似乎在某个地方放置了一个自定义对象,重定向 gem 期望有一个字符串,结果它爆炸了。

如果我删除任何引用 site.github.* 的所有实例,错误仍然存​​在。但是,如果我删除所有 redirect_froms,错误就会消失并成功构建。我对 Ruby 或这些 gem 中的任何一个都不太了解,因此无法进行很多故障排除。看起来罪魁祸首是 Jekyll-redirect-from gem.

redirector.rbthis line

我在 WasabiFan/curly-parakeet 有一个重现站点("site" 的定义非常松散)。它会在 Windows 和新的 Ubuntu VM 上抛出上述错误。

可能是什么问题?这些 gem 之一是否有必须修复的内容?

P.S。作为这个问题的结果,我发现了 GitHub 的建议回购名称的用途。谢谢。

我提交了错误报告,他们确认这是一个错误。我在 PR.

中修复了它