mirror of
https://github.com/MarginaliaSearch/MarginaliaSearch.git
synced 2025-02-23 21:18:58 +00:00
(warc) Fix NPE in WarcRecorder
This commit is contained in:
parent
85f906ea53
commit
1755b646b8
@ -203,7 +203,14 @@ public class WarcRecorder implements AutoCloseable {
|
|||||||
WarcDigestBuilder responseDigestBuilder = new WarcDigestBuilder();
|
WarcDigestBuilder responseDigestBuilder = new WarcDigestBuilder();
|
||||||
WarcDigestBuilder payloadDigestBuilder = new WarcDigestBuilder();
|
WarcDigestBuilder payloadDigestBuilder = new WarcDigestBuilder();
|
||||||
|
|
||||||
byte[] bytes = documentBody.getBytes();
|
byte[] bytes;
|
||||||
|
|
||||||
|
if (documentBody == null) {
|
||||||
|
bytes = new byte[0];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
bytes = documentBody.getBytes();
|
||||||
|
}
|
||||||
|
|
||||||
String fakeHeaders = STR."""
|
String fakeHeaders = STR."""
|
||||||
Content-Type: \{contentType}
|
Content-Type: \{contentType}
|
||||||
|
@ -91,6 +91,18 @@ class WarcRecorderTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void flagAsSkippedNullBody() throws IOException, URISyntaxException {
|
||||||
|
|
||||||
|
try (var recorder = new WarcRecorder(fileNameWarc)) {
|
||||||
|
recorder.flagAsSkipped(new EdgeUrl("https://www.marginalia.nu/"),
|
||||||
|
"text/html",
|
||||||
|
200,
|
||||||
|
null);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSaveImport() throws URISyntaxException, IOException {
|
public void testSaveImport() throws URISyntaxException, IOException {
|
||||||
try (var recorder = new WarcRecorder(fileNameWarc)) {
|
try (var recorder = new WarcRecorder(fileNameWarc)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user