Skip to content

Commit

Permalink
Artifact id must match [A-Za-z0-9-]+
Browse files Browse the repository at this point in the history
  • Loading branch information
fugerit79 committed Aug 29, 2024
1 parent 5b97154 commit 03b5927
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ private File initConfigWorker( String base ) {
@Path("/init")
public Response init( ProjectInitInput input) {
return RestHelper.defaultHandle( () -> {
// check artifact id naming
if ( !input.getArtifactId().matches( "[A-Za-z0-9-]+" ) ) {
return Response.status( Response.Status.BAD_REQUEST ).build();
}
long time = System.currentTimeMillis();
ProjectInitOutput output = new ProjectInitOutput();
try ( ByteArrayOutputStream buffer = new ByteArrayOutputStream() ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ private void testWorker( String apiPath, String jsonPayloadPath, int code ) {
void testInit() {
this.testWorker( "/project/init", "request/payload/init/init_ok_1.json", 200 );
this.testWorker( "/project/init", "request/payload/init/init_ko_1.json", 200 );
this.testWorker( "/project/init", "request/payload/init/init_ko_2.json", 400 );
Assertions.assertTrue( Boolean.TRUE ); // the condition is actually checked by rest assured
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"groupId":"org.fugerit.java.demo","artifactId":"../fugerit-doc-demo","projectVersion":"1.0.0-SNAPSHOT","javaVersion":"21","venusVersion":"8.7.4"}

0 comments on commit 03b5927

Please sign in to comment.