Skip to content

Liquid Exception: undefined method `sub' #3

@pnhofmann

Description

@pnhofmann

Hi!

crashes with Jekyll 4.0.0 on ruby 2.6.5p114 (arch linux):

Jekyll::Drops::StaticFileDrop  Liquid Exception: undefined method `sub' for #<Jekyll::Drops::StaticFileDrop:0x00005587c47f6fd8> in index.html

Works using this small patch:

diff --git a/lib/jekyll-image-size.rb b/lib/jekyll-image-size.rb
index ead00a0..560c911 100644
--- a/lib/jekyll-image-size.rb
+++ b/lib/jekyll-image-size.rb
@@ -32,7 +32,7 @@ class ImageSizeTag < Liquid::Tag
     size = FastImage.size(source)
     if context && !size
       if contextSource = rawSource = context[source]
-        contextSource = contextSource.sub(/^\//, '')
+        contextSource = contextSource.path.sub(/^\//, '')
         size = FastImage.size(contextSource)
       end
     end
(END)

But this crashes for older versions (#2)

Unfortunately don't really know ruby well so can't tell more...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions