# 특정 메시지를 채팅으로 보낼 수 없음

**URL:** <https://meta.discourse.org/t/certain-message-cannot-be-sent-in-chat/326762>\
**Category:** Bug\
**Tags:** chat, fixed\
**Created:** [9월 17, 2024, 12:56오전 UTC](https://meta.discourse.org/t/certain-message-cannot-be-sent-in-chat/326762 "2024-09-17T00:56:34Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![j.jaffeux](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/j.jaffeux/32/60297_2.png) [@j.jaffeux](https://meta.discourse.org/u/j.jaffeux)\
**Post date:** [9월 17, 2024, 9:45오전 UTC](https://meta.discourse.org/t/certain-message-cannot-be-sent-in-chat/326762/4 "2024-09-17T09:45:17Z")

</div>

`value too long for type character varying(1000)` 오류는 발췌문(excerpt)과 관련이 있는 것 같습니다. 이는 놀라운 점인데, 기술적으로 발췌문을 `150`자로 제한하고 있기 때문에 이런 경우는 절대 발생하지 않아야 하기 때문입니다. 처음에는 발췌문 생성기의 버그라고 생각했지만, 채팅에서 발췌문 코드를 살펴보니 다음과 같은 내용을 확인했습니다:

```ruby
def build_excerpt
  # 메시지 전체가 URL인 경우, 원박스를 발췌할 수 없으므로 URL만 표시합니다
  return message if UrlHelper.relaxed_parse(message).is_a?(URI)

  # 업로드 전용 메시지는 파일명으로 표현하는 것이 더 좋습니다
  return uploads.first.original_filename if cooked.blank? && uploads.present?

 # 인용구와 같은 복잡한 경우를 위해 빈 값을 반환할 수 있으며, 이는 허용됩니다
  PrettyText.excerpt(cooked, EXCERPT_LENGTH, strip_links: true, keep_mentions: true)
end

```

간단한 디버깅 결과, 실제로 `PrettyText.excerpt`에는 도달하지 못하고 첫 번째 return에서 중단되는 것을 확인했습니다. Apparently `???`가 우리의 코드로 하여금 이것이 URL이라고 생각하게 만드는 것 같습니다:

```plaintext
[1] pry(main)> UrlHelper.relaxed_parse("???\ntest").is_a?(URI)
=> true

```

---

_[View the full topic](https://meta.discourse.org/t/certain-message-cannot-be-sent-in-chat/326762)._
