-
Notifications
You must be signed in to change notification settings - Fork 317
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
(Tumblr) Add nil check to prevent undefined method error (fixes #29) #179
Conversation
I don't think this will fix the error you got. You got an error because |
Yes, you are right! I ran the importer after this change and it worked so I thought this fixed it. Now I'm confused. |
@@ -131,8 +131,10 @@ def self.post_to_hash(post, format) | |||
when "video" | |||
title = post["video-title"] | |||
content = post["video-player"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If content
is false, then it means something went wrong here.
It could have been that it also had no |
This fixed the errors I was getting:
Import process worked without error with this change. |
@@ -131,8 +131,10 @@ def self.post_to_hash(post, format) | |||
when "video" | |||
title = post["video-title"] | |||
content = post["video-player"] | |||
unless post["video-caption"].nil? | |||
content << "<br/>" + post["video-caption"] | |||
unless post[:content].nil? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this check content
?
unless content.nil? || post["video-caption"].nil?
content << "<br/>" + post["video-caption"]
end
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense, would you like me to make this change to the PR? Unfortunately, I would have no way to try it out though...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes please! :)
@parkr Updated the PR with your review comments. Sorry for the immense delay for making this change... |
@@ -131,7 +131,7 @@ def self.post_to_hash(post, format) | |||
when "video" | |||
title = post["video-title"] | |||
content = post["video-player"] | |||
unless post["video-caption"].nil? | |||
unless content.nil? || post["video-caption"].nil? | |||
content << "<br/>" + post["video-caption"] | |||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if content
is nil
, should we say content = post["video-caption"]
?
@parkr Makes sense! Updated PR. |
🎉 |
Fix for this error when importing a Tumblr blog with video posts with empty
video-player
field: