Skip to content

Commit e39fb12

Browse files
authored
Make REST endpoints accept more logger name characters (openhab#4983)
Signed-off-by: Ravi Nadahar <nadahar@rediffmail.com>
1 parent f8cb21e commit e39fb12

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

  • bundles/org.openhab.core.karaf/src/main/java/org/openhab/core/karaf/internal

bundles/org.openhab.core.karaf/src/main/java/org/openhab/core/karaf/internal/LoggerResource.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public class LoggerResource implements RESTResource {
7171
public static final String PATH_LOGGING = "logging";
7272

7373
private static final Set<String> LOG_LEVELS = Set.of(Level.strings());
74-
private static final Pattern BUNDLE_REGEX = Pattern.compile("[\\w.]+");
74+
private static final Pattern BUNDLE_REGEX = Pattern.compile("\\w[\\w. -]*");
7575

7676
private final LogService logService;
7777

@@ -91,7 +91,7 @@ public Response getLoggers(@Context UriInfo uriInfo) {
9191
}
9292

9393
@PUT
94-
@Path("/{loggerName: [a-zA-Z0-9.]+}")
94+
@Path("/{loggerName: \\w(%20|[\\w.-])*}")
9595
@Consumes(MediaType.APPLICATION_JSON)
9696
@Operation(operationId = "putLogger", summary = "Modify or add logger", responses = {
9797
@ApiResponse(responseCode = "200", description = "OK"),
@@ -108,7 +108,7 @@ public Response putLoggers(@PathParam("loggerName") @Parameter(description = "lo
108108
}
109109

110110
@GET
111-
@Path("/{loggerName: [a-zA-Z0-9.]+}")
111+
@Path("/{loggerName: \\w(%20|[\\w.-])*}")
112112
@Produces(MediaType.APPLICATION_JSON)
113113
@Operation(operationId = "getLogger", summary = "Get a single logger.", responses = {
114114
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = LoggerBean.LoggerInfo.class))) })
@@ -119,7 +119,7 @@ public Response getLogger(@PathParam("loggerName") @Parameter(description = "log
119119
}
120120

121121
@DELETE
122-
@Path("/{loggerName: [a-zA-Z0-9.]+}")
122+
@Path("/{loggerName: \\w(%20|[\\w.-])*}")
123123
@Operation(operationId = "removeLogger", summary = "Remove a single logger.", responses = {
124124
@ApiResponse(responseCode = "200", description = "OK") })
125125
public Response removeLogger(@PathParam("loggerName") @Parameter(description = "logger name") String loggerName,

0 commit comments

Comments
 (0)