# 在撰写器的标题字段中粘贴链接，如果其中包含引号字符，则会截断标题

**URL:** https://meta.discourse.org/t/pasting-a-link-in-the-composers-title-field-trims-the-title-if-theres-a-quote-character-in-it/228668
**Category:** Bug
**Created:** [2022 年5 月 31 日 21:19 UTC](https://meta.discourse.org/t/pasting-a-link-in-the-composers-title-field-trims-the-title-if-theres-a-quote-character-in-it/228668 "2022-05-31T21:19:19Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### 作者： ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### 发布日期： [2022 年5 月 31 日 21:19 UTC](https://meta.discourse.org/t/pasting-a-link-in-the-composers-title-field-trims-the-title-if-theres-a-quote-character-in-it/228668/1 "2022-05-31T21:19:19Z")

</div>

请尝试将此链接粘贴到 [try.discourse.org](http://try.discourse.org)：

![](https://cdck-file-uploads-global.s3.dualstack.us-west-2.amazonaws.com/meta/optimized/4X/a/b/4/ab4771ea643fe3a6524a4af7b89e4b364de3f10c_2_690x388.jpeg)https://www.youtube.com/embed/_6SFoqSZG3A?feature=oembed&wmode=opaque

链接的标题是 `Timecop1983 - Let's Talk (feat. Josh Dally) _ Remaster`，但在 Discourse 中生成的标题将是 `Timecop1983 - Let`：

---

<div class="post-metadata">

### 作者： ![mayfield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mayfield/32/261896_2.png) [@mayfield](https://meta.discourse.org/u/mayfield)
#### 发布日期： [2022 年6 月 5 日 01:32 UTC](https://meta.discourse.org/t/pasting-a-link-in-the-composers-title-field-trims-the-title-if-theres-a-quote-character-in-it/228668/2 "2022-06-05T01:32:47Z")

</div>

看起来问题出在 [youtube\_onebox.rb#45](https://github.com/discourse/discourse/blob/8a58ce6578ab697f29cea211049c37c2ab341ba5/lib/onebox/engine/youtube_onebox.rb#L45)  
标题中的单引号（`'`）没有进行 HTML 转义，因此过早地关闭了属性值，这会被清理掉

编辑：已提交一个 [pull request](https://github.com/discourse/discourse/pull/16999)

---

<div class="post-metadata">

### 作者： ![nat](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nat/32/235063_2.png) [@nat](https://meta.discourse.org/u/nat)
#### 发布日期： [2022 年6 月 8 日 05:47 UTC](https://meta.discourse.org/t/pasting-a-link-in-the-composers-title-field-trims-the-title-if-theres-a-quote-character-in-it/228668/6 "2022-06-08T05:47:07Z")

</div>

> [@mayfield](#):
>
> 编辑：已提交一个 [拉取请求](https://github.com/discourse/discourse/pull/16999)

已合并，感谢您的贡献 :meow_heart:

---

<div class="post-metadata">

### 作者： ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### 发布日期： [2022 年6 月 8 日 05:58 UTC](https://meta.discourse.org/t/pasting-a-link-in-the-composers-title-field-trims-the-title-if-theres-a-quote-character-in-it/228668/7 "2022-06-08T05:58:30Z")

</div>


