Skip to content

Commit

Permalink
#2205 properly escape rule role and subrole properties
Browse files Browse the repository at this point in the history
  • Loading branch information
koekeishiya committed Apr 3, 2024
1 parent 7d04856 commit 9fd250b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
### Changed
- Config *global setting* `auto_balance` is now categorized as a *space setting* instead [#2200](https://github.com/koekeishiya/yabai/issues/2200)
- Rule property space should have higher precedence than display [#2206](https://github.com/koekeishiya/yabai/issues/2206)
- Properly escape app and title regex when listing rules [#2205](https://github.com/koekeishiya/yabai/issues/2205)
- Properly escape app and title, role and subrole, regex when listing rules [#2205](https://github.com/koekeishiya/yabai/issues/2205)
- Properly escape app and title regex when listing signals [#2207](https://github.com/koekeishiya/yabai/issues/2207)

## [7.0.4] - 2024-03-30
Expand Down
8 changes: 6 additions & 2 deletions src/rule.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@ void rule_serialize(FILE *rsp, struct rule *rule, int index)

char *app = rule->app;
char *title = rule->title;
char *role = rule->role;
char *srole = rule->subrole;

char *escaped_app = app ? ts_string_escape(app) : NULL;
char *escaped_title = title ? ts_string_escape(title) : NULL;
char *escaped_role = role ? ts_string_escape(role) : NULL;
char *escaped_srole = srole ? ts_string_escape(srole) : NULL;

fprintf(rsp,
"{\n"
Expand All @@ -36,8 +40,8 @@ void rule_serialize(FILE *rsp, struct rule *rule, int index)
rule->label ? rule->label : "",
escaped_app ? escaped_app : app ? app : "",
escaped_title ? escaped_title : title ? title : "",
rule->role ? rule->role : "",
rule->subrole ? rule->subrole : "",
escaped_role ? escaped_role : role ? role : "",
escaped_srole ? escaped_srole : srole ? srole : "",
rule->effects.did ? display_manager_display_id_arrangement(rule->effects.did) : 0,
rule->effects.sid ? space_manager_mission_control_index(rule->effects.sid) : 0,
json_bool(rule_effects_check_flag(&rule->effects, RULE_FOLLOW_SPACE)),
Expand Down

0 comments on commit 9fd250b

Please sign in to comment.