Fix server icon route producing the wrong file name
All checks were successful
Deploy App / docker (ubuntu-latest, 2.44.0) (push) Successful in 9s
All checks were successful
Deploy App / docker (ubuntu-latest, 2.44.0) (push) Successful in 9s
This commit is contained in:
parent
82162b5f63
commit
ad51d4d357
@ -88,7 +88,7 @@ public final class PlayerController {
|
||||
* @return the skin part texture
|
||||
* @throws BadRequestException if the extension is invalid
|
||||
*/
|
||||
@GetMapping("/{partName}/{query}.{extension}")
|
||||
@GetMapping(value = "/{partName}/{query}.{extension}", produces = { MediaType.IMAGE_PNG_VALUE, MediaType.IMAGE_JPEG_VALUE })
|
||||
@ResponseBody
|
||||
public ResponseEntity<byte[]> getPartTexture(@PathVariable @NonNull String partName, @PathVariable @NonNull String query,
|
||||
@PathVariable @NonNull String extension, @RequestParam(required = false) String size
|
||||
|
@ -32,6 +32,7 @@ import me.braydon.mc.model.MinecraftServer;
|
||||
import me.braydon.mc.model.cache.CachedMinecraftServer;
|
||||
import me.braydon.mc.service.MojangService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@ -98,11 +99,12 @@ public final class ServerController {
|
||||
* @param hostname the hostname of the server
|
||||
* @return the server icon
|
||||
*/
|
||||
@GetMapping("/icon/{hostname}")
|
||||
@GetMapping(value = "/icon/{hostname}", produces = MediaType.IMAGE_PNG_VALUE)
|
||||
@ResponseBody
|
||||
public ResponseEntity<byte[]> getServerFavicon(@PathVariable @NonNull String hostname) {
|
||||
return ResponseEntity.ok()
|
||||
.contentType(MediaType.IMAGE_PNG)
|
||||
.header(HttpHeaders.CONTENT_DISPOSITION, "inline; filename=%s.png".formatted(hostname))
|
||||
.body(mojangService.getServerFavicon(hostname));
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user