Fix settings save: use @FormParam instead of @QueryParam for PATCH body
This commit is contained in:
@@ -8,6 +8,7 @@ import jakarta.inject.Inject;
|
||||
import jakarta.ws.rs.*;
|
||||
import jakarta.ws.rs.core.MediaType;
|
||||
import jakarta.ws.rs.core.Response;
|
||||
import java.util.List;
|
||||
|
||||
@Path("/api/settings")
|
||||
public class SettingsController {
|
||||
@@ -30,12 +31,13 @@ public class SettingsController {
|
||||
}
|
||||
|
||||
@PATCH
|
||||
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
|
||||
@Produces(MediaType.TEXT_HTML)
|
||||
public Response saveSettings(
|
||||
@QueryParam("cache_ttl_hours") @DefaultValue("8") String cacheTtl,
|
||||
@QueryParam("default_types") @DefaultValue("Album") String defaultTypes) {
|
||||
@FormParam("cache_ttl_hours") @DefaultValue("8") String cacheTtl,
|
||||
@FormParam("default_types") List<String> defaultTypes) {
|
||||
db.setSetting("cache_ttl_hours", cacheTtl);
|
||||
db.setSetting("default_types", defaultTypes);
|
||||
db.setSetting("default_types", defaultTypes != null ? String.join(",", defaultTypes) : "Album");
|
||||
return Response.ok("<div class=\"alert alert-success\">Settings saved</div>")
|
||||
.build();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user