check image mime type
This commit is contained in:
parent
4d06d08a03
commit
49c03b167e
5 changed files with 36 additions and 23 deletions
|
|
@ -273,19 +273,6 @@ let () =
|
|||
(Array.map (fun query -> Db.exec query ()) tables)
|
||||
then Dream.error (fun log -> log "can't create babillard's tables")
|
||||
|
||||
let clean_image image =
|
||||
let name, alt, content = image in
|
||||
let name =
|
||||
match name with
|
||||
| Some name -> Dream.html_escape name
|
||||
| None ->
|
||||
(* make up random name if no name was given *)
|
||||
Uuidm.to_string (Uuidm.v4_gen random_state ())
|
||||
in
|
||||
if not (is_valid_image content) then Error "invalid image"
|
||||
else if String.length alt > 1000 then Error "Image description too long"
|
||||
else Ok (name, alt, content)
|
||||
|
||||
let make_thumbnail content =
|
||||
let open Bos in
|
||||
(* jpp *)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue