编辑带有重音符号的 slug 类别时出现 404 错误

您好,我不小心创建了一个带有重音符号的 slug 和以下设置的新类别。创建此类别后,点击新类别的“编辑按钮”会重定向到 404 页面。

=> #<Category:0x00005624cbc90838
 id: 182,
 name: "Sugestões",
 color: "F7941D",
 topic_id: 257800,
 topic_count: 0,
 created_at: Thu, 13 Jan 2022 16:11:40.677256000 UTC +00:00,
 updated_at: Thu, 13 Jan 2022 16:11:40.677256000 UTC +00:00,
 user_id: 2,
 topics_year: 0,
 topics_month: 0,
 topics_week: 0,
 slug: "sugest%C3%B5es",
 description: nil,
 text_color: "FFFFFF",
 read_restricted: false,
 auto_close_hours: nil,
 post_count: 0,
 latest_post_id: nil,
 latest_topic_id: nil,
 position: 149,
 parent_category_id: nil,
 posts_year: 0,
 posts_month: 0,
 posts_week: 0,
 email_in: nil,
 email_in_allow_strangers: false,
 topics_day: 0,
 posts_day: 0,
 allow_badges: true,
 name_lower: "sugestões",
 auto_close_based_on_last_post: false,
 topic_template: nil,
 contains_messages: nil,
 sort_order: "votes",
 sort_ascending: true,
 uploaded_logo_id: nil,
 uploaded_background_id: nil,
 topic_featured_link_allowed: true,
 all_topics_wiki: false,
 show_subcategory_list: true,
 num_featured_topics: 3,
 default_view: "top",
 subcategory_list_style: "boxes",
 default_top_period: "all",
 mailinglist_mirror: false,
 minimum_required_tags: 0,
 navigate_to_first_post_after_read: false,
 search_priority: 0,
 allow_global_tags: false,
 reviewable_by_group_id: nil,
 required_tag_group_id: nil,
 min_tags_from_required_group: 1,
 read_only_banner: "",
 default_list_filter: "all",
 allow_unlimited_owner_edits_on_first_post: false
>

我通过进入 rails 控制台并更改 slug 以删除重音符号来解决了这个问题。

我相信将 slug generation method 设置为“encoded”会有所帮助:

3 个赞

此设置在我的实例中设置为 ascii,因为我实际上不希望在 slug 中出现重音符。

但在我意外放错文本字段,并在 slug 文本字段中输入了(带重音符的)名称。我认为这覆盖了生成的名称。

之后,我无法通过单击“编辑”按钮进入类别的编辑页面。

2 个赞

此问题是通过用户界面创建的,还是您使用控制台更改的 slug?您能重现此问题吗?我们应该将其重新归类为 Bug 吗?

问题是在 UI 中创建的 @sam,我提交了一个 PR 来修复它。

它已经合并,所以问题已修复。抱歉我忘了更新主题。

1 个赞

太棒了 @saquetim

非常感谢。

1 个赞

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.