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

undefined method `downcase' for nil:NilClass (NoMethodError) #263

Open
inetbiz opened this issue Sep 18, 2021 · 4 comments
Open

undefined method `downcase' for nil:NilClass (NoMethodError) #263

inetbiz opened this issue Sep 18, 2021 · 4 comments

Comments

@inetbiz
Copy link

inetbiz commented Sep 18, 2021

Error

 Liquid Exception: undefined method `downcase' for nil:NilClass in /home/denverpr/new/_layouts/tag-page.html
bundler: failed to load command: jekyll (/home/denverpr/rubyvenv/ruby/2.6/bin/jekyll)
Traceback (most recent call last):
        77: from /home/denverpr/rubyvenv/ruby/2.6/bin/bundle:23:in `<main>'
        76: from /home/denverpr/rubyvenv/ruby/2.6/bin/bundle:23:in `load'
        75: from /home/denverpr/rubyvenv/ruby/2.6/gems/bundler-2.2.27/exe/bundle:37:in `<top (required)>'
        74: from /home/denverpr/rubyvenv/ruby/2.6/gems/bundler-2.2.27/lib/bundler/friendly_errors.rb:128:in `with_friendly_errors'
        73: from /home/denverpr/rubyvenv/ruby/2.6/gems/bundler-2.2.27/exe/bundle:49:in `block in <top (required)>'
        72: from /home/denverpr/rubyvenv/ruby/2.6/gems/bundler-2.2.27/lib/bundler/cli.rb:25:in `start'
        71: from /home/denverpr/rubyvenv/ruby/2.6/gems/bundler-2.2.27/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
        70: from /home/denverpr/rubyvenv/ruby/2.6/gems/bundler-2.2.27/lib/bundler/cli.rb:31:in `dispatch'
        69: from /home/denverpr/rubyvenv/ruby/2.6/gems/bundler-2.2.27/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
        68: from /home/denverpr/rubyvenv/ruby/2.6/gems/bundler-2.2.27/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
        67: from /home/denverpr/rubyvenv/ruby/2.6/gems/bundler-2.2.27/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
        66: from /home/denverpr/rubyvenv/ruby/2.6/gems/bundler-2.2.27/lib/bundler/cli.rb:477:in `exec'
        65: from /home/denverpr/rubyvenv/ruby/2.6/gems/bundler-2.2.27/lib/bundler/cli/exec.rb:23:in `run'
        64: from /home/denverpr/rubyvenv/ruby/2.6/gems/bundler-2.2.27/lib/bundler/cli/exec.rb:58:in `kernel_load'
        63: from /home/denverpr/rubyvenv/ruby/2.6/gems/bundler-2.2.27/lib/bundler/cli/exec.rb:58:in `load'
        62: from /home/denverpr/rubyvenv/ruby/2.6/bin/jekyll:23:in `<top (required)>'
        61: from /home/denverpr/rubyvenv/ruby/2.6/bin/jekyll:23:in `load'
        60: from /home/denverpr/rubyvenv/ruby/2.6/gems/jekyll-4.2.0/exe/jekyll:15:in `<top (required)>'
        59: from /home/denverpr/rubyvenv/ruby/2.6/gems/mercenary-0.4.0/lib/mercenary.rb:21:in `program'
        58: from /home/denverpr/rubyvenv/ruby/2.6/gems/mercenary-0.4.0/lib/mercenary/program.rb:44:in `go'
        57: from /home/denverpr/rubyvenv/ruby/2.6/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `execute'
        56: from /home/denverpr/rubyvenv/ruby/2.6/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `each'
        55: from /home/denverpr/rubyvenv/ruby/2.6/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `block in execute'
        54: from /home/denverpr/rubyvenv/ruby/2.6/gems/jekyll-4.2.0/lib/jekyll/commands/build.rb:18:in `block (2 levels) in init_with_program'
        53: from /home/denverpr/rubyvenv/ruby/2.6/gems/jekyll-4.2.0/lib/jekyll/command.rb:91:in `process_with_graceful_fail'
        52: from /home/denverpr/rubyvenv/ruby/2.6/gems/jekyll-4.2.0/lib/jekyll/command.rb:91:in `each'
        51: from /home/denverpr/rubyvenv/ruby/2.6/gems/jekyll-4.2.0/lib/jekyll/command.rb:91:in `block in process_with_graceful_fail'
        50: from /home/denverpr/rubyvenv/ruby/2.6/gems/jekyll-4.2.0/lib/jekyll/commands/build.rb:36:in `process'
        49: from /home/denverpr/rubyvenv/ruby/2.6/gems/jekyll-4.2.0/lib/jekyll/commands/build.rb:65:in `build'
        48: from /home/denverpr/rubyvenv/ruby/2.6/gems/jekyll-4.2.0/lib/jekyll/command.rb:28:in `process_site'
        47: from /home/denverpr/rubyvenv/ruby/2.6/gems/jekyll-4.2.0/lib/jekyll/site.rb:80:in `process'
        46: from /home/denverpr/rubyvenv/ruby/2.6/gems/jekyll-4.2.0/lib/jekyll/site.rb:210:in `render'
        45: from /home/denverpr/rubyvenv/ruby/2.6/gems/jekyll-4.2.0/lib/jekyll/site.rb:530:in `render_docs'
        44: from /home/denverpr/rubyvenv/ruby/2.6/gems/jekyll-4.2.0/lib/jekyll/site.rb:530:in `each_value'
        43: from /home/denverpr/rubyvenv/ruby/2.6/gems/jekyll-4.2.0/lib/jekyll/site.rb:531:in `block in render_docs'
        42: from /home/denverpr/rubyvenv/ruby/2.6/gems/jekyll-4.2.0/lib/jekyll/site.rb:531:in `each'
        41: from /home/denverpr/rubyvenv/ruby/2.6/gems/jekyll-4.2.0/lib/jekyll/site.rb:532:in `block (2 levels) in render_docs'
        40: from /home/denverpr/rubyvenv/ruby/2.6/gems/jekyll-4.2.0/lib/jekyll/site.rb:547:in `render_regenerated'
        39: from /home/denverpr/rubyvenv/ruby/2.6/gems/jekyll-4.2.0/lib/jekyll/renderer.rb:63:in `run'
        38: from /home/denverpr/rubyvenv/ruby/2.6/gems/jekyll-4.2.0/lib/jekyll/renderer.rb:93:in `render_document'
        37: from /home/denverpr/rubyvenv/ruby/2.6/gems/jekyll-4.2.0/lib/jekyll/renderer.rb:163:in `place_in_layouts'
        36: from /home/denverpr/rubyvenv/ruby/2.6/gems/jekyll-4.2.0/lib/jekyll/renderer.rb:194:in `render_layout'
        35: from /home/denverpr/rubyvenv/ruby/2.6/gems/jekyll-4.2.0/lib/jekyll/renderer.rb:131:in `render_liquid'
        34: from /home/denverpr/rubyvenv/ruby/2.6/gems/jekyll-4.2.0/lib/jekyll/liquid_renderer/file.rb:36:in `render!'
        33: from /home/denverpr/rubyvenv/ruby/2.6/gems/jekyll-4.2.0/lib/jekyll/liquid_renderer/file.rb:70:in `measure_time'
        32: from /home/denverpr/rubyvenv/ruby/2.6/gems/jekyll-4.2.0/lib/jekyll/liquid_renderer/file.rb:37:in `block in render!'
        31: from /home/denverpr/rubyvenv/ruby/2.6/gems/jekyll-4.2.0/lib/jekyll/liquid_renderer/file.rb:63:in `measure_bytes'
        30: from /home/denverpr/rubyvenv/ruby/2.6/gems/jekyll-4.2.0/lib/jekyll/liquid_renderer/file.rb:38:in `block (2 levels) in render!'
        29: from /home/denverpr/rubyvenv/ruby/2.6/gems/jekyll-4.2.0/lib/jekyll/liquid_renderer/file.rb:59:in `measure_counts'
        28: from /home/denverpr/rubyvenv/ruby/2.6/gems/jekyll-4.2.0/lib/jekyll/liquid_renderer/file.rb:39:in `block (3 levels) in render!'
        27: from /home/denverpr/rubyvenv/ruby/2.6/gems/liquid-4.0.3/lib/liquid/template.rb:220:in `render!'
        26: from /home/denverpr/rubyvenv/ruby/2.6/gems/liquid-4.0.3/lib/liquid/template.rb:207:in `render'
        25: from /home/denverpr/rubyvenv/ruby/2.6/gems/liquid-4.0.3/lib/liquid/template.rb:242:in `with_profiling'
        24: from /home/denverpr/rubyvenv/ruby/2.6/gems/liquid-4.0.3/lib/liquid/template.rb:208:in `block in render'
        23: from /home/denverpr/rubyvenv/ruby/2.6/gems/liquid-4.0.3/lib/liquid/block_body.rb:91:in `render'
        22: from /home/denverpr/rubyvenv/ruby/2.6/gems/liquid-4.0.3/lib/liquid/block_body.rb:103:in `render_node_to_output'
        21: from /home/denverpr/rubyvenv/ruby/2.6/gems/jekyll_picture_tag-2.0.3/lib/jekyll_picture_tag.rb:71:in `render'
        20: from /home/denverpr/rubyvenv/ruby/2.6/gems/jekyll_picture_tag-2.0.3/lib/jekyll_picture_tag/output_formats/basic.rb:10:in `to_s'
        19: from /home/denverpr/rubyvenv/ruby/2.6/gems/jekyll_picture_tag-2.0.3/lib/jekyll_picture_tag/output_formats/picture.rb:66:in `base_markup'
        18: from /home/denverpr/rubyvenv/ruby/2.6/gems/jekyll_picture_tag-2.0.3/lib/jekyll_picture_tag/output_formats/picture.rb:26:in `build_sources'
        17: from /home/denverpr/rubyvenv/ruby/2.6/gems/jekyll_picture_tag-2.0.3/lib/jekyll_picture_tag/output_formats/picture.rb:26:in `collect'
        16: from /home/denverpr/rubyvenv/ruby/2.6/gems/jekyll_picture_tag-2.0.3/lib/jekyll_picture_tag/output_formats/picture.rb:26:in `block in build_sources'
        15: from /home/denverpr/rubyvenv/ruby/2.6/gems/jekyll_picture_tag-2.0.3/lib/jekyll_picture_tag/output_formats/picture.rb:39:in `build_source'
        14: from /home/denverpr/rubyvenv/ruby/2.6/gems/jekyll_picture_tag-2.0.3/lib/jekyll_picture_tag/output_formats/basic.rb:57:in `add_srcset'
        13: from /home/denverpr/rubyvenv/ruby/2.6/gems/jekyll_picture_tag-2.0.3/lib/jekyll_picture_tag/srcsets/basic.rb:36:in `to_s'
        12: from /home/denverpr/rubyvenv/ruby/2.6/gems/jekyll_picture_tag-2.0.3/lib/jekyll_picture_tag/srcsets/basic.rb:32:in `to_a'
        11: from /home/denverpr/rubyvenv/ruby/2.6/gems/jekyll_picture_tag-2.0.3/lib/jekyll_picture_tag/srcsets/basic.rb:28:in `files'
        10: from /home/denverpr/rubyvenv/ruby/2.6/gems/jekyll_picture_tag-2.0.3/lib/jekyll_picture_tag/srcsets/basic.rb:67:in `build_files'
         9: from /home/denverpr/rubyvenv/ruby/2.6/gems/jekyll_picture_tag-2.0.3/lib/jekyll_picture_tag/srcsets/basic.rb:67:in `all?'
         8: from /home/denverpr/rubyvenv/ruby/2.6/gems/jekyll_picture_tag-2.0.3/lib/jekyll_picture_tag/images/generated_image.rb:21:in `exists?'
         7: from /home/denverpr/rubyvenv/ruby/2.6/gems/jekyll_picture_tag-2.0.3/lib/jekyll_picture_tag/images/generated_image.rb:31:in `absolute_filename'
         6: from /home/denverpr/rubyvenv/ruby/2.6/gems/jekyll_picture_tag-2.0.3/lib/jekyll_picture_tag/images/generated_image.rb:37:in `name'
         5: from /home/denverpr/rubyvenv/ruby/2.6/gems/jekyll_picture_tag-2.0.3/lib/jekyll_picture_tag/images/generated_image.rb:67:in `id'
         4: from /home/denverpr/rubyvenv/ruby/2.6/gems/jekyll_picture_tag-2.0.3/lib/jekyll_picture_tag/images/generated_image.rb:71:in `settings'
         3: from /home/denverpr/rubyvenv/ruby/2.6/gems/jekyll_picture_tag-2.0.3/lib/jekyll_picture_tag/images/generated_image.rb:57:in `quality'
         2: from /home/denverpr/rubyvenv/ruby/2.6/gems/jekyll_picture_tag-2.0.3/lib/jekyll_picture_tag/images/generated_image.rb:17:in `format'
         1: from /home/denverpr/rubyvenv/ruby/2.6/gems/jekyll_picture_tag-2.0.3/lib/jekyll_picture_tag/images/generated_image.rb:86:in `process_format'
/home/denverpr/rubyvenv/ruby/2.6/gems/jekyll_picture_tag-2.0.3/lib/jekyll_picture_tag/images/source_image.rb:73:in `ext':undefined method `downcase' for nil:NilClass (NoMethodError)

Tag

{% picture blog-feature {{page.featured_image}} --alt {{page.excerpt}} %}

HTML Syntax Test

 <header>
   <figure>
    <figcaption>{{page.featured_image | inspect}}</figcaption>
  </figure>
</header>

Output

<figure><figcaption>"prestashop-tag.jpg"</figcaption></figure>

Gem info

(ruby:2.6)[denverpr@pluto new]$ gem info jekyll_picture_tag

*** LOCAL GEMS ***

jekyll_picture_tag (2.0.3)
    Authors: Robert Wierzbowski, Brendan Tobolaski, Robert Buchberger
    Homepage: https://github.com/rbuchberger/jekyll_picture_tag
    License: BSD-3-Clause
    Installed at: /home/denverpr/rubyvenv/ruby/2.6

    Easy responsive images for Jekyll.

FS Info

(ruby:2.6)[denverpr@pluto _fullsize]$ pwd
/home/denverpr/new/assets/images/_fullsize(ruby:2.6)[denverpr@pluto _fullsize]$ ll prestashop-tag.jpg
-rw-r--r-- 1 denverpr denverpr 65905 Sep 18 10:16 prestashop-tag.jpg
@inetbiz
Copy link
Author

inetbiz commented Sep 19, 2021

from jekyll_picture_tag/images/source_image.rb:73:in ext':undefined method downcase for nil:NilClass (NoMethodError)

 # /home/dave/my_blog/assets/images/somefolder/myimage.jpg
    #                                                     ^^^
    def ext
      @ext ||= File.extname(name)[1..].downcase
    end
``

@rbuchberger
Copy link
Owner

Hm. Are you sure it's getting passed a filename? What exactly is in the page.featured_image variable?

I thought JPT would fail more gracefully than this, it's probably worth adding a check for that.

@inetbiz
Copy link
Author

inetbiz commented Sep 21, 2021

the loop...

<header>
   <figure>
    <figcaption>{{page.featured_image | inspect}}</figcaption>
  </figure>
</header>

Output

<figure><figcaption>"prestashop-tag.jpg"</figcaption></figure>
I also ran it through a mime detection program to see if the jpg was corrupt.

@Atem18
Copy link

Atem18 commented Dec 30, 2021

Hi,

I am using the tag with {% picture "{{ page.featured_image }}" %} which in the blog post is:
featured_image: "/uploads/test.jpg"

And I have the following error undefined method `delete_prefix' for nil:NilClass

Could this be linked ?

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

3 participants