From e08cf998d5c775aaac313d92f6e41b53f0602fce Mon Sep 17 00:00:00 2001 From: 0xb00bface <0xboobface@gmail.com> Date: Sun, 27 Dec 2020 13:28:13 +0100 Subject: [PATCH] Remove query part from segment file name --- .../java/ctbrec/recorder/download/hls/HlsDownload.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/common/src/main/java/ctbrec/recorder/download/hls/HlsDownload.java b/common/src/main/java/ctbrec/recorder/download/hls/HlsDownload.java index 7f296686..d83e53c2 100644 --- a/common/src/main/java/ctbrec/recorder/download/hls/HlsDownload.java +++ b/common/src/main/java/ctbrec/recorder/download/hls/HlsDownload.java @@ -124,7 +124,12 @@ public class HlsDownload extends AbstractHlsDownload2 { @Override protected OutputStream getSegmentOutputStream(String prefix, String fileName) throws FileNotFoundException { - File file = FileSystems.getDefault().getPath(downloadDir.toAbsolutePath().toString(), prefix + '_' + fileName).toFile(); + String prefixedFileName = prefix + '_' + fileName; + int questionMarkPosition = prefixedFileName.indexOf('?'); + if (questionMarkPosition > 0) { + prefixedFileName = prefixedFileName.substring(0, questionMarkPosition); + } + File file = FileSystems.getDefault().getPath(downloadDir.toAbsolutePath().toString(), prefixedFileName).toFile(); return new FileOutputStream(file); }