Merge conflict fixes

This commit is contained in:
aditya.chandel
2025-08-29 10:55:28 -06:00
parent 342039ea4b
commit e4fe1ab029
4 changed files with 5 additions and 26 deletions

View File

@@ -23,8 +23,7 @@ public class KoreaderController {
@GetMapping("/users/auth")
public ResponseEntity<Map<String, String>> authorizeUser() {
return koreaderService
.authorizeUser()
.contentType(MediaType.APPLICATION_JSON);
.authorizeUser();
}
@PostMapping("/users/create")

View File

@@ -330,7 +330,7 @@ public class DoubanBookParser implements BookParser {
String encodedSearchTerm = searchTerm.toString().replace(" ", "+");
String url = "https://search.douban.com/book/subject_search?search_text=" + encodedSearchTerm;
log.info("Query URL: {}", url);
log.info("Douban Query URL: {}", url);
return url;
}

View File

@@ -23,8 +23,6 @@ import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Path;
@@ -171,26 +169,9 @@ public class FileService {
return input == null ? null : (input.length() <= maxLength ? input : input.substring(0, maxLength));
}
private void resizeAndSaveImage(String imageSource, File outputFolder, String outputFileName) throws IOException {
BufferedImage originalImage;
File file = new File(imageSource);
if (file.exists()) {
try (InputStream inputStream = new FileInputStream(file)) {
originalImage = ImageIO.read(inputStream);
}
} else {
try {
URL url = new URL(imageSource);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36");
connection.setConnectTimeout(10000);
connection.setReadTimeout(10000);
try (InputStream inputStream = connection.getInputStream()) {
originalImage = ImageIO.read(inputStream);
}
} catch (IOException e) {
throw new IOException("Failed to download image from URL: " + imageSource + " - " + e.getMessage(), e);
}
private void validateCoverFile(MultipartFile file) {
if (file.isEmpty()) {
throw new IllegalArgumentException("Uploaded file is empty");
}
String contentType = file.getContentType();
if (!(JPEG_MIME_TYPE.equalsIgnoreCase(contentType) || PNG_MIME_TYPE.equalsIgnoreCase(contentType))) {

View File

@@ -36,7 +36,6 @@ class KoreaderControllerTest {
when(koreaderService.authorizeUser()).thenReturn(ResponseEntity.ok(expected));
ResponseEntity<Map<String, String>> resp = controller.authorizeUser();
assertEquals(HttpStatus.OK, resp.getStatusCode());
assertEquals(MediaType.APPLICATION_JSON, resp.getHeaders().getContentType());
assertEquals(expected, resp.getBody());
}