arina-ielchiieva commented on a change in pull request #1788: DRILL-7204: Add
proper validation when creating plugin
URL: https://github.com/apache/drill/pull/1788#discussion_r284259374
##########
File path:
exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/StorageResources.java
##########
@@ -204,6 +204,13 @@ public JsonResult
createOrUpdatePluginJSON(PluginConfigWrapper plugin) {
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
@Produces(MediaType.APPLICATION_JSON)
public JsonResult createOrUpdatePlugin(@FormParam("name") String name,
@FormParam("config") String storagePluginConfig) {
+ name = name.trim();
+ if (name.isEmpty()) {
+ return message("Error (a storage name cannot be empty)");
+ }
+ if (!name.matches("^[a-zA-Z0-9._-]+$")) {
Review comment:
Since we don't enforce this on the backend side, I don't think we should
enforce this on the frontend side as well.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services