Skip to content

Commit

Permalink
Xapi_event: do not convert to lowercase if already lowercase
Browse files Browse the repository at this point in the history
Tasks are lowercase

Signed-off-by: Edwin Török <[email protected]>
  • Loading branch information
edwintorok committed Apr 21, 2024
1 parent 3248809 commit 278b6c6
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions ocaml/xapi/xapi_event.ml
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,13 @@ module Subscription = struct
(Api_errors.event_subscription_parse_failure, [x])
)

let is_lowercase_char c = Char.equal (Char.lowercase_ascii c) c

let is_lowercase str = String.for_all is_lowercase_char str

(** [table_matches subs tbl]: true if at least one subscription from [subs] would select some events from [tbl] *)
let table_matches subs tbl =
let tbl = String.lowercase_ascii tbl in
let tbl = if is_lowercase tbl then tbl else String.lowercase_ascii tbl in
let matches = function
| All ->
true
Expand All @@ -88,7 +92,7 @@ module Subscription = struct

(** [event_matches subs ev]: true if at least one subscription from [subs] selects for specified class and object *)
let object_matches subs ty _ref =
let tbl = String.lowercase_ascii ty in
let tbl = if is_lowercase ty then ty else String.lowercase_ascii ty in
let matches = function
| All ->
true
Expand Down

0 comments on commit 278b6c6

Please sign in to comment.