Skip to content

Commit

Permalink
fix saving bookmarks (#1383)
Browse files Browse the repository at this point in the history
change form method to POST. That way the %3F is part of the form data and not part of the url, so apache
does not complain anymore.
  • Loading branch information
sni committed Jul 22, 2024
1 parent 8550980 commit 825dd5b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
7 changes: 7 additions & 0 deletions root/thruk/javascript/thruk-3.16.js
Original file line number Diff line number Diff line change
Expand Up @@ -8133,6 +8133,13 @@ function check_filter_style_changes(form, pageStyle, columnFieldId) {
var status_form_clean = true;
function setNoFormClean() {
status_form_clean = false;

return(true);
}

function changeFormToPost(el) {
jQuery(el).parents('form:first').attr("method", "POST")
return(true);
}

/* remove empty values from form to reduce request size */
Expand Down
9 changes: 5 additions & 4 deletions templates/_add_bookmark.tt
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@

<div>
[% IF style != 'combined' %]
<form action='status.cgi' method="GET" id="bookmark_form">
<input type="submit" value="add bookmark" name="addb" onclick="return(checknonempty('newname', 'name') && setNoFormClean())" style="position: absolute; left: -9999px; width: 1px; height: 1px;"/>
<form action='status.cgi' method="POST" id="bookmark_form">
<input type="submit" value="add bookmark" name="addb" onclick="return(checknonempty('newname', 'name') && setNoFormClean() && changeFormToPost(this))" style="position: absolute; left: -9999px; width: 1px; height: 1px;"/>
[% END %]
<input type="hidden" name="referer" value="[% short_uri(c) %]">
<input type="hidden" name="CSRFtoken" value="[% get_user_token(c) %]">
<table class="body sub_2">
<tr>
<th>Url</th>
Expand Down Expand Up @@ -60,7 +61,7 @@
</tr>
<tr>
<td colspan="2" align="center">
<input class="w-36 my-2" type="submit" value="add bookmark" name="addb" onclick="return(checknonempty('newname', 'name') && setNoFormClean())">
<input class="w-36 my-2" type="submit" value="add bookmark" name="addb" onclick="return(checknonempty('newname', 'name') && setNoFormClean() && changeFormToPost(this))">
</td>
</tr>
</table>
Expand Down Expand Up @@ -162,7 +163,7 @@

<tr class="no-hover">
<td colspan="4" align="center">
<input type="submit" class="w-36 my-2" value="save changes" name="saveb" onclick="return(setNoFormClean())">
<input type="submit" class="w-36 my-2" value="save changes" name="saveb" onclick="return(setNoFormClean() && changeFormToPost(this))">
</td>
</tr>
</table>
Expand Down

0 comments on commit 825dd5b

Please sign in to comment.