Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

静态资源名称与未发布的文章/页面别名相同时访问返回 404 #4309

Closed
wan92hen opened this issue Jul 26, 2023 · 2 comments · Fixed by #4318
Closed

静态资源名称与未发布的文章/页面别名相同时访问返回 404 #4309

wan92hen opened this issue Jul 26, 2023 · 2 comments · Fixed by #4318
Assignees
Labels
area/core Issues or PRs related to the Halo Core kind/bug Categorizes issue or PR as related to a bug.
Milestone

Comments

@wan92hen
Copy link
Collaborator

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

v2.8.0-rc.1

使用的什么数据库?

PostgreSQL

使用的哪种方式部署?

Docker Compose

在线站点地址

No response

发生了什么?

问题描述:

  1. 在静态资源目录创建 test.html 文件,访问 /test.html 地址,可以正常显示文件内容;
  2. 在控制台创建并发布页面,别名也配置为 test.html
  3. 再次访问 /test.html 地址,页面内容变为上一步创建的页面;
  4. 取消发布步骤 3 中创建的页面,再次访问 /test.html 地址,返回 404 页面。

取消发布页面后,访问 /test.html 地址应该可以返回静态资源目录 test.html 的内容。

相关日志输出

No response

附加信息

No response

@JohnNiang
Copy link
Member

/assign
/kind bug
/area core
/milestone 2.8.x

@f2c-ci-robot f2c-ci-robot bot added the kind/bug Categorizes issue or PR as related to a bug. label Jul 27, 2023
@f2c-ci-robot f2c-ci-robot bot added this to the 2.8.x milestone Jul 27, 2023
@f2c-ci-robot f2c-ci-robot bot added the area/core Issues or PRs related to the Halo Core label Jul 27, 2023
@JohnNiang
Copy link
Member

目前仅页面的路由好处理一些。文章,标签,分类等路由是通过规则(例如 /archives/**)匹配的,无法在路由匹配阶段过滤掉未发布的文章。

f2c-ci-robot bot pushed a commit that referenced this issue Jul 28, 2023
#### What type of PR is this?

/kind bug
/area core
/milestone 2.8.x

#### What this PR does / why we need it:

- Remove route when single pages become unpublished
- Add some unit tests against the change.

#### Which issue(s) this PR fixes:

Fixes #4309

#### Special notes for your reviewer:

1. Create a single page with slug name `about.html` and publish it.
2. Create a static file `about.html` into static folder`${halo.work-dir}/static/`.
3. Try to request <http://localhost:8090/about.html> and check the result.
4. Unpublish the single page and then do the step 3 again.

#### Does this PR introduce a user-facing change?

```release-note
修复页面取消发布后访问仍然出现页面未找到错误。
```
@JohnNiang JohnNiang modified the milestones: 2.8.x, 2.8.0 Jul 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/core Issues or PRs related to the Halo Core kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants