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

Liquid Exception: undefined method `sub' #3

Open
pnhofmann opened this issue Dec 20, 2019 · 1 comment
Open

Liquid Exception: undefined method `sub' #3

pnhofmann opened this issue Dec 20, 2019 · 1 comment

Comments

@pnhofmann
Copy link

pnhofmann commented Dec 20, 2019

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...

@pnhofmann pnhofmann changed the title Crash on Jekyll 4.0.0 / ruby 2.6.5 Liquid Exception: undefined method `sub' Dec 20, 2019
@MrHinsh
Copy link

MrHinsh commented Oct 25, 2023

Any fix for this?

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

2 participants