# 导入器基础中 PostCreator 检查不足

**URL:** <https://meta.discourse.org/t/insufficient-checking-of-postcreator-in-importer-base/110570>\
**Category:** Bug\
**Created:** [2019年三月3日 18:52 UTC](https://meta.discourse.org/t/insufficient-checking-of-postcreator-in-importer-base/110570 "2019-03-03T18:52:50Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![nmcgovern](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nmcgovern/32/132630_2.png) [@nmcgovern](https://meta.discourse.org/u/nmcgovern)\
**Post date:** [2019年三月3日 18:52 UTC](https://meta.discourse.org/t/insufficient-checking-of-postcreator-in-importer-base/110570/1 "2019-03-03T18:52:50Z")

</div>

Hi,

It seems that if (for example) you mistakenly try and add `target_usernames` to a post with `user_id`s rather than `username`s, `create_post` in `scripts/import_scripts/base.rb` won’t return an error.

This is because it returns: `post ? post : post_creator.errors.full_messages`. However, `post` has already been initialised as a `Post` type on line 564. Checking for the `post_creator` errors instead returns the correct behaviour.

I’ll submit a pull request for this 🙂

---

<div class="post-metadata">

**Author:** ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)\
**Post date:** [2019年三月3日 23:14 UTC](https://meta.discourse.org/t/insufficient-checking-of-postcreator-in-importer-base/110570/2 "2019-03-03T23:14:06Z")

</div>

> [@nmcgovern](#):
>
> I’ll submit a pull request for this

Sure, please do. 🤗

---

<div class="post-metadata">

**Author:** ![nmcgovern](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nmcgovern/32/132630_2.png) [@nmcgovern](https://meta.discourse.org/u/nmcgovern)\
**Post date:** [2019年三月4日 00:00 UTC](https://meta.discourse.org/t/insufficient-checking-of-postcreator-in-importer-base/110570/3 "2019-03-04T00:00:59Z")

</div>

[https://github.com/discourse/discourse/pull/7096](https://github.com/discourse/discourse/pull/7096)

---

<div class="post-metadata">

**Author:** ![jomaxro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jomaxro/32/126216_2.png) [@jomaxro](https://meta.discourse.org/u/jomaxro)\
**Post date:** [2019年三月8日 04:09 UTC](https://meta.discourse.org/t/insufficient-checking-of-postcreator-in-importer-base/110570/4 "2019-03-08T04:09:25Z")

</div>

The PR has been merged.

---

<div class="post-metadata">

**Author:** ![jomaxro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jomaxro/32/126216_2.png) [@jomaxro](https://meta.discourse.org/u/jomaxro)\
**Post date:** [2019年三月9日 23:00 UTC](https://meta.discourse.org/t/insufficient-checking-of-postcreator-in-importer-base/110570/5 "2019-03-09T23:00:11Z")

</div>

This topic was automatically closed after 42 hours. New replies are no longer allowed.
