Import script (phpbb)


(Ryan Mulligan) #1

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


(Gerhard Schlager) #2

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.


(Ryan Mulligan) #3

@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?


(Gerhard Schlager) #4

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:


(Ryan Mulligan) #5

Ah, okay. I made a PR to move where the bbcode_to_md conversion happens for phpbb: phpbb-import-script: move bbcode_to_md to before other text processing by ryantm · Pull Request #4054 · discourse/discourse · GitHub


(Régis Hanol) #6