Import script (phpbb)

Hello.

I tried this against the latest discourse master bff965327c0677768e58dd9eaf2b834a22d2342f

The issue is if you have a phpbb post that contains exactly

https://www.youtube.com/watch?v=COvnHv42T-A

and you are using @neil’s version of bbcode_to_md. You have a raw post_text of

<!-- m --><a class="postlink" href="https://www.youtube.com/watch?v=COvnHv42T-A">https://www.youtube.com/watch?v=COvnHv42T-A</a><!-- m -->

which goes through text_processor.rb process_links which changes it to

[youtube.com/watch?v=COvnHv42T-A](https://www.youtube.com/watch?v=COvnHv42T-A)

which then goes through bbcode_to_md code and turns into

http://www.youtube.com/watch?v=COvnHv42T-A)

It seems that the problem is that the import script text_processor is assuming that process_links is going to happen after the bbcode_to_md is run in base.rb, but it happens before. If I reverse the order of them by moving the bbcode_to_md call into text_processor.rb, it seems to fix it, but I’m not sure if that breaks other import scripts.

Ryan

1 Like

Yeah, I noticed that too. Never found the time for fixing it.
I usually recommend to import without bbcode_to_md. In my experience it’s not worth the effort since it has a lot of small issues like this.

@gerhard Maybe I don’t understand what bbcode_to_md does, but if you don’t use bbcode_to_md, doesn’t that mean there will be bbcodes in your posts?

It depends on the BBCodes you are using. The default ones are handled quite well even without bbcode_to_md.
Discourse already supports some BBCodes and the import script tries to replace the not supported ones.

Just give it a try and look at the result. :wink:

Ah, okay. I made a PR to move where the bbcode_to_md conversion happens for phpbb: https://github.com/discourse/discourse/pull/4054

2 Likes