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); }