Skip to content

Commit dd89fff

Browse files
david-truongbrianchandotcom
authored andcommitted
LPD-15347 ensure request is a post
1 parent 6a2544a commit dd89fff

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

modules/apps/change-tracking/change-tracking-web/src/main/java/com/liferay/change/tracking/web/internal/portlet/action/UpdateCTCommentMVCResourceCommand.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@
1414
import com.liferay.portal.kernel.portlet.JSONPortletResponseUtil;
1515
import com.liferay.portal.kernel.portlet.bridges.mvc.MVCResourceCommand;
1616
import com.liferay.portal.kernel.security.permission.ActionKeys;
17+
import com.liferay.portal.kernel.servlet.HttpMethods;
1718
import com.liferay.portal.kernel.theme.ThemeDisplay;
1819
import com.liferay.portal.kernel.util.ParamUtil;
20+
import com.liferay.portal.kernel.util.StringUtil;
1921
import com.liferay.portal.kernel.util.WebKeys;
2022

2123
import javax.portlet.ResourceRequest;
@@ -42,6 +44,10 @@ protected void doServeResource(
4244
ResourceRequest resourceRequest, ResourceResponse resourceResponse)
4345
throws Exception {
4446

47+
if (!StringUtil.equals(resourceRequest.getMethod(), HttpMethods.POST)) {
48+
return;
49+
}
50+
4551
ThemeDisplay themeDisplay = (ThemeDisplay)resourceRequest.getAttribute(
4652
WebKeys.THEME_DISPLAY);
4753

modules/apps/change-tracking/change-tracking-web/src/main/resources/META-INF/resources/publications/js/components/ChangeTrackingComments.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,9 @@ export default function ChangeTrackingComments({
9999
ctEntryId,
100100
});
101101

102-
fetch(portletURL)
102+
fetch(portletURL, {
103+
method: 'post',
104+
})
103105
.then((response) => response.json())
104106
.then((json) => {
105107
if (!json.comments) {
@@ -135,7 +137,9 @@ export default function ChangeTrackingComments({
135137
ctEntryId,
136138
});
137139

138-
fetch(portletURL)
140+
fetch(portletURL, {
141+
method: 'post',
142+
})
139143
.then((response) => response.json())
140144
.then((json) => {
141145
if (!json.comments) {
@@ -169,7 +173,9 @@ export default function ChangeTrackingComments({
169173
value: inputValue,
170174
});
171175

172-
fetch(portletURL.toString())
176+
fetch(portletURL.toString(), {
177+
method: 'post',
178+
})
173179
.then((response) => response.json())
174180
.then((json) => {
175181
setDeleting(0);
@@ -211,7 +217,9 @@ export default function ChangeTrackingComments({
211217
value: newValue,
212218
});
213219

214-
fetch(portletURL)
220+
fetch(portletURL, {
221+
method: 'post',
222+
})
215223
.then((response) => response.json())
216224
.then((json) => {
217225
setDeleting(0);

0 commit comments

Comments
 (0)