From 3f0bcc30ff112dc38e882f4f08b8c37d693799ef Mon Sep 17 00:00:00 2001 From: rich Date: Sun, 24 Oct 2004 11:34:37 +0000 Subject: [PATCH] Non-existant files and images throw 404, instead of 500, errors. Bumped version for release. --- debian/changelog | 2 +- scripts/file.ml | 13 ++++++++----- scripts/image.ml | 13 ++++++++----- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/debian/changelog b/debian/changelog index eb013d0..63d9fe5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -cocanwiki (1.3.2-4) unstable; urgency=low +cocanwiki (1.3.2-5) unstable; urgency=low * Initial Release. diff --git a/scripts/file.ml b/scripts/file.ml index eb45b71..28685df 100644 --- a/scripts/file.ml +++ b/scripts/file.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * Copyright (C) 2004 Merjis Ltd. - * $Id: file.ml,v 1.10 2004/10/24 08:48:38 rich Exp $ + * $Id: file.ml,v 1.11 2004/10/24 11:34:37 rich Exp $ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -48,10 +48,13 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid _ _ = sth#execute args; let data, mime_type, deleted = - match sth#fetch1 () with - [ `Binary data; `String mime_type; `Bool deleted ] -> - data, mime_type, deleted - | _ -> assert false in + try + (match sth#fetch1 () with + [ `Binary data; `String mime_type; `Bool deleted ] -> + data, mime_type, deleted + | _ -> assert false) + with + Not_found -> raise (HttpError cHTTP_NOT_FOUND) in (* If deleted, refuse to serve this file except if called from the * deleted files page. diff --git a/scripts/image.ml b/scripts/image.ml index a625d78..0558950 100644 --- a/scripts/image.ml +++ b/scripts/image.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * Copyright (C) 2004 Merjis Ltd. - * $Id: image.ml,v 1.10 2004/10/24 08:48:38 rich Exp $ + * $Id: image.ml,v 1.11 2004/10/24 11:34:37 rich Exp $ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -50,10 +50,13 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid _ _ = sth#execute args; let data, mime_type, deleted = - match sth#fetch1 () with - [ `Binary data; `String mime_type; `Bool deleted ] -> - data, mime_type, deleted - | _ -> assert false in + try + (match sth#fetch1 () with + [ `Binary data; `String mime_type; `Bool deleted ] -> + data, mime_type, deleted + | _ -> assert false) + with + Not_found -> raise (HttpError cHTTP_NOT_FOUND) in (* If deleted, refuse to serve this image except if called from the * deleted images page. -- 1.8.3.1