fix the fix
This commit is contained in:
parent
f60d5f2114
commit
98711948b6
@ -26,20 +26,20 @@ public class IndexController {
|
||||
this.pasteService = pasteService;
|
||||
}
|
||||
|
||||
@GetMapping(value = "/")
|
||||
public String home() {
|
||||
return "index";
|
||||
}
|
||||
|
||||
/**
|
||||
* This is to allow for Hastebin compatibility.
|
||||
*/
|
||||
@PostMapping(value = "/documents")
|
||||
public ResponseEntity<?> uploadPaste(@RequestBody String content, @RequestHeader(HttpHeaders.CONTENT_TYPE) String contentType) {
|
||||
public ResponseEntity<?> uploadPaste(@RequestBody String content, @RequestHeader(value = HttpHeaders.CONTENT_TYPE, required = false) String contentType) {
|
||||
String id = pasteService.createPaste(content, contentType);
|
||||
return ResponseEntity.ok(Map.of("key", id));
|
||||
}
|
||||
|
||||
@GetMapping(value = "/")
|
||||
public String home() {
|
||||
return "index";
|
||||
}
|
||||
|
||||
@GetMapping(value = "/{id}")
|
||||
public String paste(@PathVariable String id, Model model) {
|
||||
try {
|
||||
|
@ -56,7 +56,7 @@ public class PasteService {
|
||||
}
|
||||
|
||||
// Ensure the paste content type is valid.
|
||||
if (contentType.contains("image") || contentType.contains("video") || contentType.contains("audio")) {
|
||||
if (contentType != null && (contentType.contains("image") || contentType.contains("video") || contentType.contains("audio"))) {
|
||||
log.info("Paste content type is not supported. (content type: {})", contentType);
|
||||
throw new BadRequestException("The paste content type is not supported, not uploading...");
|
||||
}
|
||||
|
Reference in New Issue
Block a user