# Problème avec \`discourse remap\` lors du remappage de \`topic\_links url\`

**URL:** <https://meta.discourse.org/t/trouble-with-discourse-remap-remapping-topic-links-url/110052>\
**Category:** Bug\
**Created:** [Février 25, 2019, 5:31 UTC](https://meta.discourse.org/t/trouble-with-discourse-remap-remapping-topic-links-url/110052 "2019-02-25T17:31:20Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)\
**Post date:** [Février 28, 2019, 3:47 UTC](https://meta.discourse.org/t/trouble-with-discourse-remap-remapping-topic-links-url/110052/6 "2019-02-28T15:47:22Z")

</div>

Hey @Falco, would truncating the URL in line 120 fix this?

change it to

```
    uri = UrlHelper.relaxed_parse(u.url[0..self.max_url_length])

```

> <https://github.com/discourse/discourse/blob/main/app/models/topic_link.rb#L120>

EDIT: well, on my first attempt, this yielded

```plaintext
Remapping topic_links url
Error: ERROR: duplicate key value violates unique constraint "unique_post_links"
DETAIL: Key (topic_id, post_id, url)=(19484, 61049, https://staging.community.rstudio.com/t/birds-of-a-feather-bof-at-rstudio-conf-2019l/19328) already exists.
The remap has only been partially applied due to the error above. Please re-run the script again.

```

So short of a database migration to make the URL longer. . . maybe add another `rescue` on duplicate URLs and let them pass? So also add a

```
    rescue PG::UniqueViolation

```

that does nothing?

---

_[View the full topic](https://meta.discourse.org/t/trouble-with-discourse-remap-remapping-topic-links-url/110052)._
