Problem with import script ipboard3.rb

AI-generated summary

The discussion revolves around resolving an issue with the import script ipboard3.rb. dr3adx is experiencing an error with the clean_up method due to nil input. pfaffman suggests the error occurs because the method is being called with raw as nil and proposes modifying the clean_up method to handle this.

dr3adx attempts to modify the method but faces issues with posts and personal messages being imported empty. pfaffman suspects a database query issue, and riking recommends a more suitable modification to the clean_up method.

dr3adx is puzzled by the issue, having verified the column names. pfaffman advises testing the script’s queries to ensure they provide the expected data and suggests replacing to_i.zero? with length == 0 to avoid incorrect results.

I’m trying to import data from my ipb forum and running script ipboard3 gives me the following error:

script/import_scripts/ipboard3.rb:375:in `clean_up': undefined method `encode!' for nil:NilClass (NoMethodError)
root@forum:/var/www/discourse#  `clean_up': undefined method `encode!'

Why is it giving undefined method ‘encode!’ :confused:

Because it’s getting called with raw being nil.

So you’ll need to figure out which function is calling it and why it’s not getting data for the raw data for the post.

My guess is this line:

           bio_raw: clean_up(u["pp_about_me"]),

If that’s the case, then maybe what to do is modify clean_up so that it’ll return nil if it gets no data.

is this good?

if raw.to_i.zero?
return
end

I tried this and it did import all users and topics and posts but posts have no body (they’re empty) got any idea why? I don’t think adding “return nil” would make much difference, what do you think?
also all personal messages got imported but they’re empty too

The database query is wrong for some reason. It’s not getting the data for the post content.

No, that’ll trigger way too often. Try this:

return if raw.nil?

That’s weird because I’m using IPB3 and I checked the column names and they match :open_mouth:

If you do the queries that the script is doing, do they provide the data that you expect?

Did you change your

if raw.to_i.zero?

to something like

if raw.length == 0

"randome text".to_i.zero? will always be true.