Mbox importer broken (with patch)


(Andrea Soster) #1

Dears,

the mbox importer is broken, these are the errors I’m getting:

discourse@ubuntu-app:/var/www/discourse/script/import_scripts$ ruby mbox.rb
loading existing groups...
loading existing users...
loading existing categories...
loading existing posts...
loading existing topics...

creating indices
      187 / 188 ( 99.5%)
importing users
       24 / 24 (100.0%)
creating forum topics
/var/www/discourse/lib/email/receiver.rb:26:in `initialize': wrong number of arguments (2 for 1) (ArgumentError)
        from mbox.rb:151:in `new'
        from mbox.rb:151:in `block (2 levels) in create_forum_topics'
        from /var/www/discourse/script/import_scripts/base.rb:421:in `block in create_posts'
        from /var/www/discourse/script/import_scripts/base.rb:420:in `each'
        from /var/www/discourse/script/import_scripts/base.rb:420:in `create_posts'
        from mbox.rb:149:in `block in create_forum_topics'
        from /var/www/discourse/script/import_scripts/base.rb:702:in `block in batches'
        from /var/www/discourse/script/import_scripts/base.rb:701:in `loop'
        from /var/www/discourse/script/import_scripts/base.rb:701:in `batches'
        from mbox.rb:143:in `create_forum_topics'
        from mbox.rb:17:in `execute'
        from /var/www/discourse/script/import_scripts/base.rb:45:in `perform'
        from mbox.rb:212:in `<main>'

and:

discourse@ubuntu-app:/var/www/discourse/script/import_scripts$ ruby mbox.rb
loading existing groups...
loading existing users...
loading existing categories...
loading existing posts...
loading existing topics...

importing users
Skipping 24 already imported users

creating forum topics
/var/www/discourse/lib/email/receiver.rb:98:in `select_body': wrong number of arguments (1 for 0) (ArgumentError)
        from mbox.rb:155:in `block (2 levels) in create_forum_topics'
        from /var/www/discourse/script/import_scripts/base.rb:421:in `block in create_posts'
        from /var/www/discourse/script/import_scripts/base.rb:420:in `each'
        from /var/www/discourse/script/import_scripts/base.rb:420:in `create_posts'
        from mbox.rb:149:in `block in create_forum_topics'
        from /var/www/discourse/script/import_scripts/base.rb:702:in `block in batches'
        from /var/www/discourse/script/import_scripts/base.rb:701:in `loop'
        from /var/www/discourse/script/import_scripts/base.rb:701:in `batches'
        from mbox.rb:143:in `create_forum_topics'
        from mbox.rb:17:in `execute'
        from /var/www/discourse/script/import_scripts/base.rb:45:in `perform'
        from mbox.rb:212:in `<main>'

I think that this commit broke it, and the fix is quite easy.

Please see the attached patch: mbox.rb.diff.txt (1.4 KB)


(Régis Hanol) #2

Why don’t you submit a PR instead? We :heart: pull requests :wink:


(Andrea Soster) #3

Because I don’t have a github account:-D but will create one and do it.
Can I bother you to ask if you plan on adding the feature to import email
attachments from mbox import?
Another thing on the mbox import :threading is done by reply to, would it
be hard to try to merge topics by title? I’ve seen some topics duplicate
(split actually) but with the same title
Thanks


(Andrea Soster) #4

PR created


(Andrea Soster) #5

I have the attachment import functionality working for mbox import. Will clean it up and open a new pr soon


(Andrea Soster) #6

(Finally) created the PR with my enhacements to mbox importer


(Sam Saffron) #7

PR was just merged! :slight_smile:


(Sam Saffron) #8