objective categorical abstract machine language personal data server
65
fork

Configure Feed

Select the types of activity you want to include in your feed.

Clean up utils

futurGH 225fca3f 06dd9963

+10 -11
+1 -1
pegasus/lib/api/identity/updateHandle.ml
··· 13 13 in 14 14 match Util.validate_handle handle with 15 15 | Error e -> 16 - raise e 16 + Errors.invalid_request ~name:"InvalidHandle" e 17 17 | Ok () -> ( 18 18 match%lwt Data_store.get_actor_by_identifier handle db with 19 19 | Some _ ->
+1 -1
pegasus/lib/api/repo/createAccount.ml
··· 38 38 | Ok _ -> 39 39 () 40 40 | Error e -> 41 - raise e 41 + Errors.invalid_request ~name:"InvalidHandle" e 42 42 in 43 43 let%lwt () = 44 44 match%lwt
+8 -9
pegasus/lib/util.ml
··· 276 276 Timedesc.(of_timestamp_float_s_exn s |> to_iso8601) 277 277 278 278 (* returns all blob refs in a record *) 279 - let find_blob_refs (record : Mist.Lex.repo_record) : Mist.Blob_ref.t list = 279 + let rec find_blob_refs (record : Mist.Lex.repo_record) : Mist.Blob_ref.t list = 280 280 List.fold_left 281 281 (fun acc (_, value) -> 282 - match value with `BlobRef blob -> blob :: acc | _ -> acc ) 282 + match value with 283 + | `BlobRef blob -> blob :: acc 284 + | `LexMap map -> (find_blob_refs map) @ acc 285 + | _ -> acc ) 283 286 [] 284 287 (Mist.Lex.String_map.bindings record) 285 288 286 - (* returns whether the value is None *) 287 - let is_none = function None -> true | _ -> false 288 - 289 289 let validate_handle handle = 290 290 let front = 291 291 String.sub handle 0 (String.length handle - (String.length Env.hostname + 1)) 292 292 in 293 293 if String.contains front '.' then 294 294 Error 295 - (Errors.InvalidRequestError 296 - ("InvalidHandle", "invalid characters in handle") ) 295 + "handle can't contain periods" 297 296 else 298 297 match String.length front with 299 298 | l when l < 3 -> 300 - Error (Errors.InvalidRequestError ("InvalidHandle", "handle too short")) 299 + Error "handle too short" 301 300 | l when l > 18 -> 302 - Error (Errors.InvalidRequestError ("InvalidHandle", "handle too long")) 301 + Error "handle too long" 303 302 | _ -> 304 303 Ok () 305 304