Skip to content

Commit

Permalink
replaceDescription is not robust (jenkinsci#8307)
Browse files Browse the repository at this point in the history
(cherry picked from commit 3172131)
  • Loading branch information
basil committed Aug 7, 2023
1 parent bc6bff2 commit 833ce66
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
6 changes: 1 addition & 5 deletions core/src/main/resources/lib/hudson/editable-description.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@
e.preventDefault();
let url = descriptionLink.getAttribute("data-url");
let description = descriptionLink.getAttribute("data-description");
if (url == null && description == null) {
return replaceDescription();
} else {
return replaceDescription(description, url);
}
return replaceDescription(description, url);
});
});
})();
10 changes: 5 additions & 5 deletions war/src/main/webapp/scripts/hudson-behavior.js
Original file line number Diff line number Diff line change
Expand Up @@ -1973,11 +1973,11 @@ function replaceDescription(initialDescription, submissionUrl) {
d.firstElementChild.nextElementSibling.innerHTML =
"<div class='jenkins-spinner'></div>";
let parameters = {};
if (initialDescription !== undefined && submissionUrl !== undefined) {
parameters = {
description: initialDescription,
submissionUrl: submissionUrl,
};
if (initialDescription !== null && initialDescription !== "") {
parameters["description"] = initialDescription;
}
if (submissionUrl !== null && submissionUrl !== "") {
parameters["submissionUrl"] = submissionUrl;
}
fetch("./descriptionForm", {
method: "post",
Expand Down

0 comments on commit 833ce66

Please sign in to comment.