Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle improperly defined Watcher Logging Action text parameter. #60169

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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