Skip to content

Commit

Permalink
fix: exception occurs when the file size bytes cannot be retrieved
Browse files Browse the repository at this point in the history
  • Loading branch information
guqing committed Jan 3, 2025
1 parent 4018612 commit 1ad379c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/src/main/java/run/halo/feed/RssXmlBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.google.common.base.Throwables;
import java.io.StringReader;
import java.nio.charset.StandardCharsets;
import java.time.Duration;
import java.time.Instant;
import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;
Expand Down Expand Up @@ -33,6 +34,7 @@ public class RssXmlBuilder {
+ "Chrome/131.0.0.0 Safari/537.36";
private final WebClient webClient = WebClient.builder()
.clientConnector(new ReactorClientHttpConnector(HttpClient.create()
.responseTimeout(Duration.ofSeconds(1))
.followRedirect(true))
)
.build();
Expand Down Expand Up @@ -313,6 +315,6 @@ private Long getFileSizeBytes(String url) {
)
.onErrorReturn(0L)
.blockOptional()
.orElseThrow();
.orElse(0L);
}
}

0 comments on commit 1ad379c

Please sign in to comment.