halo icon indicating copy to clipboard operation
halo copied to clipboard

文章、分类、标签及自定义页面别名可以重复

Open wan92hen opened this issue 3 years ago • 3 comments

检查清单

是什么版本出现了此问题?

2.0

使用的什么数据库?

H2

使用的哪种方式部署?

Docker

在线站点地址

No response

发生了什么?

文章、分类、标签及自定义页面可以使用相同的名称和别名,导致在主题端无法正常浏览相同别名的文章和自定义页面。 1663832317298

相关日志输出

No response

附加信息

No response

wan92hen avatar Sep 22 '22 07:09 wan92hen

/kind improvement /milestone 2.0 /area core

ruibaby avatar Sep 23 '22 13:09 ruibaby

目前已经在 https://github.com/halo-dev/halo/pull/2460 中实现如果出现重复 slug 会记录日志且不会将对应的 permalink 注册到路由。

暂时先不在创建的时候添加验证器。

ruibaby avatar Sep 27 '22 02:09 ruibaby

目前已经在 #2460 中实现如果出现重复 slug 会记录日志且不会将对应的 permalink 注册到路由。

暂时先不在创建的时候添加验证器。

验证了一下,虽然后台出现了 slug 重复的报错,但是在管理端还是可以正常创建出这个内容,并且是已发布或正常状态。 反映到主题端还是会同时看到两个链接一致的内容。

2022-09-27T10:35:37.028+08:00 ERROR 7 --- [ool-16-thread-1] r.h.app.theme.router.PermalinkIndexer    : Permalink [/page1] already exists, you can try to change the slug [ExtensionLocator[gvk=content.halo.run/v1alpha1/SinglePage, name=9efef725-4f4d-4744-b30c-45ba93b1cf13, slug=page1]].

针对文章、自定义页面这种存在发布操作的内容,是否增加一个发布失败状态,如果 slug 重复会发布失败,在主题端不会展示出来。

针对标签、分类这种直接创建的,后续应该要按创建、更新失败来处理。

wan92hen avatar Sep 27 '22 03:09 wan92hen

/triage duplicate

See https://github.com/halo-dev/halo/issues/3172

/close

ruibaby avatar Feb 02 '23 15:02 ruibaby

@ruibaby: Closing this issue.

In response to this:

/triage duplicate

See https://github.com/halo-dev/halo/issues/3172

/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

f2c-ci-robot[bot] avatar Feb 02 '23 15:02 f2c-ci-robot[bot]