Edgewall Software
Modify

Opened 18 years ago

Closed 18 years ago

#4009 closed defect (fixed)

trac should response 404 not found instead of 500 when files is not found

Reported by: moo Owned by: Christian Boos
Priority: normal Milestone: 0.11
Component: general Version: 0.10
Severity: minor Keywords: http 404
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

Attachments (0)

Change History (6)

comment:1 by Christian Boos, 18 years ago

Keywords: http added
Milestone: 0.11
Owner: changed from Jonas Borgström to Christian Boos

We should introduce a MissingResource error, subclass of TracError and from which NoSuchNode would inherit. The attachment code, ticket module etc. can raise the former directly.

comment:2 by Christopher Lenz, 18 years ago

Why not just make the versioncontrol UI components catch NoSuchXxx and in turn raise HttpNotFound for now? I don't see why we need another exception layer there.

comment:3 by Christian Boos, 18 years ago

Well, raising MissingResource looks like a good intermediate between the catch-all TracError and the Web specific HTTPNotFound, so that we could do:

  • trac/web/main.py

     
    260260                    raise err[0], err[1], err[2]
    261261            except PermissionError, e:
    262262                raise HTTPForbidden(to_unicode(e))
     263            except MissingResource, e:
     264                raise HTTPNotFound(e.message)
    263265            except TracError, e:
    264266                raise HTTPInternalError(e.message)
    265267        finally:

comment:4 by sid <sid.wiesner@…>, 18 years ago

This is related to #2118, a ticket to use proper HTTP status codes.

comment:5 by Christian Boos, 18 years ago

Keywords: 404 added
Severity: normalminor
Status: newassigned

See also #4518. The corresponding fix (r5554) implements the idea above (ResourceNotFound instead of MissingResource).

There's now a 404 for files not found in the browser, but this is not yet done for missing attachments.

comment:6 by Christian Boos, 18 years ago

Resolution: fixed
Status: assignedclosed

Implemented in r5629.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Christian Boos.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Christian Boos to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.