Fix bug, which caused the HLS servlet to double up the recordings path
This commit is contained in:
parent
5135e10c19
commit
d76ee3994b
|
@ -50,7 +50,8 @@ public class HlsServlet extends AbstractCtbrecServlet {
|
||||||
boolean idOnly = request.indexOf('/') < 0;
|
boolean idOnly = request.indexOf('/') < 0;
|
||||||
if (idOnly) {
|
if (idOnly) {
|
||||||
requestFile = rec.get().getPostProcessedFile();
|
requestFile = rec.get().getPostProcessedFile();
|
||||||
requestedFilePath = requestFile.getCanonicalPath();
|
serveSegment(req, resp, requestFile);
|
||||||
|
return;
|
||||||
} else {
|
} else {
|
||||||
requestedFilePath = request.substring(request.indexOf('/'));
|
requestedFilePath = request.substring(request.indexOf('/'));
|
||||||
requestFile = new File(requestedFilePath);
|
requestFile = new File(requestedFilePath);
|
||||||
|
@ -73,7 +74,6 @@ public class HlsServlet extends AbstractCtbrecServlet {
|
||||||
}
|
}
|
||||||
} catch (InvalidKeyException | NoSuchAlgorithmException | IllegalStateException e1) {
|
} catch (InvalidKeyException | NoSuchAlgorithmException | IllegalStateException e1) {
|
||||||
writeResponse(resp, SC_UNAUTHORIZED, "{\"status\": \"error\", \"msg\": \"Authentication failed\"}");
|
writeResponse(resp, SC_UNAUTHORIZED, "{\"status\": \"error\", \"msg\": \"Authentication failed\"}");
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,7 +99,6 @@ public class HlsServlet extends AbstractCtbrecServlet {
|
||||||
|
|
||||||
private void serveSegment(HttpServletRequest req, HttpServletResponse resp, File requestedFile) throws IOException {
|
private void serveSegment(HttpServletRequest req, HttpServletResponse resp, File requestedFile) throws IOException {
|
||||||
MimetypesFileTypeMap map = new MimetypesFileTypeMap();
|
MimetypesFileTypeMap map = new MimetypesFileTypeMap();
|
||||||
//String mimetype = requestedFile.getName().endsWith(".mp4") ? "video/mp4" : "application/octet-stream";
|
|
||||||
String mimetype = map.getContentType(requestedFile);
|
String mimetype = map.getContentType(requestedFile);
|
||||||
LOG.debug("Serving {} as {}", requestedFile.getName(), mimetype);
|
LOG.debug("Serving {} as {}", requestedFile.getName(), mimetype);
|
||||||
serveFile(req, resp, requestedFile, mimetype);
|
serveFile(req, resp, requestedFile, mimetype);
|
||||||
|
|
Loading…
Reference in New Issue