···1313 in
1414 match Util.validate_handle handle with
1515 | Error e ->
1616- raise e
1616+ Errors.invalid_request ~name:"InvalidHandle" e
1717 | Ok () -> (
1818 match%lwt Data_store.get_actor_by_identifier handle db with
1919 | Some _ ->
+1-1
pegasus/lib/api/repo/createAccount.ml
···3838 | Ok _ ->
3939 ()
4040 | Error e ->
4141- raise e
4141+ Errors.invalid_request ~name:"InvalidHandle" e
4242 in
4343 let%lwt () =
4444 match%lwt
+8-9
pegasus/lib/util.ml
···276276 Timedesc.(of_timestamp_float_s_exn s |> to_iso8601)
277277278278(* returns all blob refs in a record *)
279279-let find_blob_refs (record : Mist.Lex.repo_record) : Mist.Blob_ref.t list =
279279+let rec find_blob_refs (record : Mist.Lex.repo_record) : Mist.Blob_ref.t list =
280280 List.fold_left
281281 (fun acc (_, value) ->
282282- match value with `BlobRef blob -> blob :: acc | _ -> acc )
282282+ match value with
283283+ | `BlobRef blob -> blob :: acc
284284+ | `LexMap map -> (find_blob_refs map) @ acc
285285+ | _ -> acc )
283286 []
284287 (Mist.Lex.String_map.bindings record)
285288286286-(* returns whether the value is None *)
287287-let is_none = function None -> true | _ -> false
288288-289289let validate_handle handle =
290290 let front =
291291 String.sub handle 0 (String.length handle - (String.length Env.hostname + 1))
292292 in
293293 if String.contains front '.' then
294294 Error
295295- (Errors.InvalidRequestError
296296- ("InvalidHandle", "invalid characters in handle") )
295295+ "handle can't contain periods"
297296 else
298297 match String.length front with
299298 | l when l < 3 ->
300300- Error (Errors.InvalidRequestError ("InvalidHandle", "handle too short"))
299299+ Error "handle too short"
301300 | l when l > 18 ->
302302- Error (Errors.InvalidRequestError ("InvalidHandle", "handle too long"))
301301+ Error "handle too long"
303302 | _ ->
304303 Ok ()
305304