# 访问特定主题的修订时出现服务器错误

**URL:** https://meta.discourse.org/t/server-error-accessing-topic-revisions-on-a-specific-topic/339185
**Category:** Bug
**Tags:** rest-api
**Created:** [2024年十一月29日 01:48 UTC](https://meta.discourse.org/t/server-error-accessing-topic-revisions-on-a-specific-topic/339185 "2024-11-29T01:48:07Z")
**Posts on this page:** 14
**Page:** 1

<div class="post-metadata">

### Author: ![paulofonseca.eth](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/paulofonseca.eth/32/468962_2.png) [@paulofonseca.eth](https://meta.discourse.org/u/paulofonseca.eth)
#### Post date: [2024年十一月29日 01:48 UTC](https://meta.discourse.org/t/server-error-accessing-topic-revisions-on-a-specific-topic/339185/1 "2024-11-29T01:48:08Z")

</div>

**优先级/严重性** : 严重 / 数据丢失

**平台** : 在所有设备类型、操作系统和浏览器中均观察到

**描述** : 在官方 Discourse 托管的付费 Discourse 实例中，用于查看主题编辑内容的模态框无法针对特定主题正常工作。此外，API 只返回修订版本 5 ([revision 5](https://forum.arbitrum.foundation/posts/62786/revisions/5.json)) 之前的所有帖子修订版本，而无法返回该版本之后的任何后续版本，例如版本 6、7、8 或 9，这些版本会返回 500 代码，即内部服务器错误。

**重现步骤** :

1. 转到 [https://forum.arbitrum.foundation/t/designing-and-operating-the-reporting-and-information-function/27609](https://forum.arbitrum.foundation/t/designing-and-operating-the-reporting-and-information-function/27609)
2. 点击帖子日期旁边的橙色编辑铅笔图标
3. 模态框不显示

![CleanShot 2024-11-29 at 03.37.15](https://global.discourse-cdn.com/meta/original/4X/5/8/1/5810c4262f74cef14794ab274e85de6f96c82146.gif)

---

<div class="post-metadata">

### Author: ![supermathie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/supermathie/32/507518_2.png) [@supermathie](https://meta.discourse.org/u/supermathie)
#### Post date: [2024年十一月29日 01:50 UTC](https://meta.discourse.org/t/server-error-accessing-topic-revisions-on-a-specific-topic/339185/2 "2024-11-29T01:50:43Z")

</div>

这可能是设计使然——网站管理员可以限制对帖子修订历史记录的查看权限，而这可能就是此处发生的情况。

如果不是这样，并且它应该可见，那么这就不是数据丢失。

由于这是一个托管网站，如果网站管理员提出协助请求，我们可以进行调查。

---

<div class="post-metadata">

### Author: ![paulofonseca.eth](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/paulofonseca.eth/32/468962_2.png) [@paulofonseca.eth](https://meta.discourse.org/u/paulofonseca.eth)
#### Post date: [2024年十一月29日 02:15 UTC](https://meta.discourse.org/t/server-error-accessing-topic-revisions-on-a-specific-topic/339185/4 "2024-11-29T02:15:56Z")

</div>

嘿 @supermathie 感谢你对此事的关注！

在这种情况下，管理员并未限制帖子历史记录。否则，最初的版本就不应该可以通过 API 访问，但它们是可以的，就像我在上面链接的那样。

我相信这是因为该用户进行了一次编辑，并将 Google 文档的内容粘贴了进去。我认为可能粘贴了某个字符，导致数据损坏。

如果你能对此进行调查，那就太好了！

---

<div class="post-metadata">

### Author: ![supermathie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/supermathie/32/507518_2.png) [@supermathie](https://meta.discourse.org/u/supermathie)
#### Post date: [2024年十一月29日 02:21 UTC](https://meta.discourse.org/t/server-error-accessing-topic-revisions-on-a-specific-topic/339185/5 "2024-11-29T02:21:34Z")

</div>

我确实看到这些请求中有错误被记录下来，我们会派人去处理。

---

<div class="post-metadata">

### Author: ![paulofonseca.eth](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/paulofonseca.eth/32/468962_2.png) [@paulofonseca.eth](https://meta.discourse.org/u/paulofonseca.eth)
#### Post date: [2024年十一月29日 02:23 UTC](https://meta.discourse.org/t/server-error-accessing-topic-revisions-on-a-specific-topic/339185/7 "2024-11-29T02:23:03Z")

</div>

非常感谢！😊

---

<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: [2024年十一月29日 09:31 UTC](https://meta.discourse.org/t/server-error-accessing-topic-revisions-on-a-specific-topic/339185/9 "2024-11-29T09:31:35Z")

</div>

从服务器日志中的错误来看，我很有信心不会丢失任何数据，我已经将其添加到团队的列表中，我们将在接下来的 7 天内进行查看，并在问题解决后告知您。

---

<div class="post-metadata">

### Author: ![paulofonseca.eth](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/paulofonseca.eth/32/468962_2.png) [@paulofonseca.eth](https://meta.discourse.org/u/paulofonseca.eth)
#### Post date: [2024年十一月29日 11:23 UTC](https://meta.discourse.org/t/server-error-accessing-topic-revisions-on-a-specific-topic/339185/10 "2024-11-29T11:23:46Z")

</div>

谢谢 @sam！🙏

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [2024年十一月30日 14:49 UTC](https://meta.discourse.org/t/server-error-accessing-topic-revisions-on-a-specific-topic/339185/12 "2024-11-30T14:49:16Z")

</div>

感谢 @paulofonseca.eth 的报告，此问题将通过以下方式修复：

> <https://github.com/discourse/discourse/pull/30014>
>
> When serializing the \`body\_changes\` in the \`PostRevisionSerializer\`, we create t…wo diffs: one for the \`cooked\` and another one for the \`raw\` version of the post.
> 
> Inside \`DiscourseDiff\`, we generate both \`html\` and \`markdown\` diffs when we only need the \`html\` diffs for the \`cooked\` version of the post and the \`markdown\` diff for the \`raw\` version of the post.
> 
> This solves the issue repored in https://meta.discourse.org/t/server-error-accessing-topic-revisions-on-a-specific-topic/339185 where some revisions would return 500 because of a \`ArgumentError : Attributes per element limit exceeded\` exception when trying to generate the \`html\` diff on a very large \`raw\`.

---

<div class="post-metadata">

### Author: ![paulofonseca.eth](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/paulofonseca.eth/32/468962_2.png) [@paulofonseca.eth](https://meta.discourse.org/u/paulofonseca.eth)
#### Post date: [2024年十一月30日 17:40 UTC](https://meta.discourse.org/t/server-error-accessing-topic-revisions-on-a-specific-topic/339185/13 "2024-11-30T17:40:02Z")

</div>

太棒了！=) 我必须说，这周转速度真是惊人！👏  
它已经可以用了！=)

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [2024年十一月30日 18:15 UTC](https://meta.discourse.org/t/server-error-accessing-topic-revisions-on-a-specific-topic/339185/14 "2024-11-30T18:15:32Z")

</div>

修复尚未部署到该实例。修订版 #5 仍然“损坏” 😉

我点击了“部署”按钮，大约 10 分钟后应该就可以上线了。

---

<div class="post-metadata">

### Author: ![paulofonseca.eth](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/paulofonseca.eth/32/468962_2.png) [@paulofonseca.eth](https://meta.discourse.org/u/paulofonseca.eth)
#### Post date: [2024年十一月30日 18:24 UTC](https://meta.discourse.org/t/server-error-accessing-topic-revisions-on-a-specific-topic/339185/15 "2024-11-30T18:24:18Z")

</div>

是的，我刚注意到 5 到 12 版本都没有显示，API 中也没有。

谢谢！

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [2024年十一月30日 18:28 UTC](https://meta.discourse.org/t/server-error-accessing-topic-revisions-on-a-specific-topic/339185/16 "2024-11-30T18:28:51Z")

</div>

搞定了 😉

---

<div class="post-metadata">

### Author: ![paulofonseca.eth](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/paulofonseca.eth/32/468962_2.png) [@paulofonseca.eth](https://meta.discourse.org/u/paulofonseca.eth)
#### Post date: [2024年十一月30日 18:33 UTC](https://meta.discourse.org/t/server-error-accessing-topic-revisions-on-a-specific-topic/339185/17 "2024-11-30T18:33:19Z")

</div>

太棒了！！刚看到！干得漂亮！非常感谢！=)

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [2024年十二月2日 07:00 UTC](https://meta.discourse.org/t/server-error-accessing-topic-revisions-on-a-specific-topic/339185/18 "2024-12-02T07:00:30Z")

</div>

此主题已在 40 小时后自动关闭。不再允许回复。
