Skip to content

Conversation

@xrgzs
Copy link
Member

@xrgzs xrgzs commented Aug 19, 2025

Close: #1086

Only modify the behavior of /d/*path, /p/*path, /ad/*path, /ap/*path, /ae/*path.

Not affect /api.

The API will always respond with a 200 status code, with the actual status code wrapped in a JSON object, like the previous response.

Some error status responses are still under discussion. Returning a 500 status code for all errors may not be the most optimal approach.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR modifies error handling for web endpoints to return HTML error pages with proper HTTP status codes instead of JSON responses. The change affects download and archive endpoints (/d/*path, /p/*path, /ad/*path, /ap/*path, /ae/*path) while preserving API behavior.

  • Replaces common.ErrorResp calls with common.ErrorPage in download and archive handlers
  • Adds new ErrorPage function that generates HTML error pages with proper status codes
  • Maintains existing error logging and privacy filtering functionality

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
server/common/common.go Adds ErrorPage function to generate HTML error pages with status codes
server/handles/down.go Updates download handlers to use ErrorPage instead of ErrorResp
server/handles/archive.go Updates archive handlers to use ErrorPage instead of ErrorResp
server/middlewares/down.go Updates middleware error handling to use ErrorPage

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

@PIKACHUIM PIKACHUIM self-requested a review August 19, 2025 02:25
@xrgzs xrgzs marked this pull request as ready for review August 19, 2025 03:54
@PIKACHUIM PIKACHUIM merged commit b04677b into OpenListTeam:main Aug 19, 2025
14 checks passed
@xrgzs xrgzs deleted the errorpage branch August 19, 2025 07:28
KirCute added a commit to KirCute/OpenList that referenced this pull request Aug 19, 2025
xrgzs pushed a commit that referenced this pull request Aug 19, 2025
lyy2005a2 pushed a commit to lyy2005a2/OpenList that referenced this pull request Aug 24, 2025
* 重构(docker):减小docker镜像大小(2)
* feat(share):支持更安全的文件共享(28)
* feat(server):添加错误页面和状态码(2)重复server/handles/archive.go(1)重复server/middlewares/down.go(1)
* feat(123_open):添加选项 (4)
* feat(服务器):将 OpenListTeam#1099 改编为 OpenListTeam#991 (0)重复(3)[server/handles/archive.go=server/handles/down.go=server/handles/sharing.go]
ForSourceCodeAnalysis pushed a commit to ForSourceCodeAnalysis/OpenList that referenced this pull request Oct 4, 2025
ForSourceCodeAnalysis pushed a commit to ForSourceCodeAnalysis/OpenList that referenced this pull request Oct 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG][设计问题]/d方面 200包500

2 participants