Skip to content

Commit

Permalink
RedirectWriter: Fixup httrack URLs (to percent encode spaces etc)
Browse files Browse the repository at this point in the history
  • Loading branch information
ato committed Aug 6, 2024
1 parent 04ca3e6 commit 05c5f0c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/au/gov/nla/httrack2warc/RedirectWriter.java
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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" +
Expand Down

0 comments on commit 05c5f0c

Please sign in to comment.