Skip to content

Commit

Permalink
Handle improperly defined Watcher Logging Action text parameter. (#60169
Browse files Browse the repository at this point in the history
) (#60188)
  • Loading branch information
cjcenizal authored Mar 14, 2020
1 parent 050b629 commit 1cf7368
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,18 @@ export class LoggingAction extends BaseAction {

get upstreamJson() {
const result = super.upstreamJson;
const text = !!this.text.trim() ? this.text : undefined;
let text;

if (typeof this.text === 'string') {
// If this.text is a non-empty string, we can send it to the API.
if (!!this.text.trim()) {
text = this.text;
}
} else {
// If the user incorrectly defined this.text, e.g. as an object in a JSON watch, let the API
// deal with it.
text = this.text;
}

Object.assign(result, {
text,
Expand Down

0 comments on commit 1cf7368

Please sign in to comment.