From 05c5f0ce1848b15650ec2825cd4e8482df6f8362 Mon Sep 17 00:00:00 2001 From: Alex Osborne Date: Tue, 6 Aug 2024 13:22:21 +0900 Subject: [PATCH] RedirectWriter: Fixup httrack URLs (to percent encode spaces etc) --- src/au/gov/nla/httrack2warc/RedirectWriter.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/au/gov/nla/httrack2warc/RedirectWriter.java b/src/au/gov/nla/httrack2warc/RedirectWriter.java index 76bed95..4caae03 100644 --- a/src/au/gov/nla/httrack2warc/RedirectWriter.java +++ b/src/au/gov/nla/httrack2warc/RedirectWriter.java @@ -1,5 +1,6 @@ package au.gov.nla.httrack2warc; +import au.gov.nla.httrack2warc.httrack.HtsUtil; import au.gov.nla.httrack2warc.httrack.HttrackRecord; import java.io.ByteArrayInputStream; @@ -23,7 +24,7 @@ public RedirectWriter(String prefix, WarcWriter warc) { public void write(HttrackRecord record, Instant warcDate) throws IOException { // build synthetic redirect record if (prefix != null && record.getFilename() != null) { - String httrackUrl = prefix + record.getFilename(); + String httrackUrl = HtsUtil.fixupUrl(prefix + record.getFilename()); byte[] body = new byte[0]; String header = "HTTP/1.1 301 Moved Permanently\r\n" + "Location: " + record.getUrl() + "\r\n" +