X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=scripts%2Ffile.ml;h=4345b11218ded440ef55095975a479fc14bbb5da;hb=fffce48503e09a21f9c5846a0fc378e6180e50f3;hp=28685df244c559e1c3e17ddceffe5dae5903fa04;hpb=c1b34fa103bb05ed3cbef458c458a4851de41f78;p=cocanwiki.git diff --git a/scripts/file.ml b/scripts/file.ml index 28685df..4345b11 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.11 2004/10/24 11:34:37 rich Exp $ + * $Id: file.ml,v 1.12 2004/11/01 16:24:32 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 @@ -28,7 +28,7 @@ open ExtString open Cocanwiki -let run r (q : cgi) (dbh : Dbi.connection) hostid _ _ = +let run r (q : cgi) (dbh : Dbi.connection) hostid {hostname = hostname} _ = let name = q#param "name" in let version = try Some (int_of_string (q#param "version")) with Not_found -> None in @@ -56,14 +56,12 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid _ _ = with Not_found -> raise (HttpError cHTTP_NOT_FOUND) in - (* If deleted, refuse to serve this file except if called from the - * deleted files page. - *) + (* If deleted, refuse to serve this file except if called from the site. *) if deleted then ( let referer = try Table.get (Request.headers_in r) "Referer" with Not_found -> "" in let ok = - try String.find referer "/_files?deleted"; true + try String.find referer hostname; true with String.Invalid_string -> false in if not ok then (