autoresearch iter 3: share upload-record error mapping via filesrv helper

ServeFileByID and DownloadFile duplicated the lookup failure mapping and
each used an unchecked *strconv.NumError assertion that cannot match a
wrapped error. One helper now classifies 404 vs 400 via errors.As; each
endpoint keeps its own fallback for unclassified failures. ErrInvalidUploadID
became unused once both sites report ErrInvalidFileID for a malformed ID.
This commit is contained in:
ryan
2026-08-29 08:02:42 +08:00
parent 4e6209bf61
commit 686e3ef5a6
3 changed files with 19 additions and 13 deletions
@@ -43,7 +43,6 @@ const (
ErrFileRecordNotFound = "文件记录未找到"
ErrFileNotFound = "文件未找到"
ErrOperationForbidden = "无权操作"
ErrInvalidUploadID = "无效的上传ID"
ErrInvalidAccessModeParam = "无效的 access_mode 参数"
ErrInternalServerError = "服务器内部错误"
)