mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-07 10:04:21 +00:00
added validation of page url
This commit is contained in:
@@ -79,8 +79,14 @@ public class FeedbackRestRepository extends DSpaceRestRepository<FeedbackRest, I
|
||||
throw new DSpaceBadRequestException("e-mail and message fields are mandatory!");
|
||||
}
|
||||
|
||||
String pageUrl = feedbackRest.getPage();
|
||||
String urlPrefix = configurationService.getProperty("dspace.ui.url");
|
||||
if (! StringUtils.startsWith(pageUrl, urlPrefix)) {
|
||||
throw new DSpaceBadRequestException("unexpected page url was submitted");
|
||||
}
|
||||
|
||||
try {
|
||||
feedbackService.sendEmail(context, req, recipientEmail, senderEmail, message, feedbackRest.getPage());
|
||||
feedbackService.sendEmail(context, req, recipientEmail, senderEmail, message, pageUrl);
|
||||
} catch (IOException | MessagingException e) {
|
||||
throw new RuntimeException(e.getMessage(), e);
|
||||
}
|
||||
@@ -100,4 +106,4 @@ public class FeedbackRestRepository extends DSpaceRestRepository<FeedbackRest, I
|
||||
this.feedbackService = feedbackService;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user