From 9bae98cf57736f85d6b1ef605fb1ae96e3cdbac9 Mon Sep 17 00:00:00 2001 From: WithoutPants <53250216+WithoutPants@users.noreply.github.com> Date: Thu, 16 Mar 2023 15:45:25 +1100 Subject: [PATCH] Fix /stream endpoint serving directory for fileless scenes (#3541) * Fix stream endpoint serving folder * Hide stream link for fileless scenes --- internal/api/routes_scene.go | 7 +++++++ .../Scenes/SceneDetails/SceneFileInfoPanel.tsx | 14 ++++++++------ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/internal/api/routes_scene.go b/internal/api/routes_scene.go index 112d4dbf9..c01c43104 100644 --- a/internal/api/routes_scene.go +++ b/internal/api/routes_scene.go @@ -88,7 +88,14 @@ func (rs sceneRoutes) Routes() chi.Router { // region Handlers func (rs sceneRoutes) StreamDirect(w http.ResponseWriter, r *http.Request) { + scene := r.Context().Value(sceneKey).(*models.Scene) + // #3526 - return 404 if the scene does not have any files + if scene.Path == "" { + w.WriteHeader(http.StatusNotFound) + return + } + sceneHash := scene.GetHash(config.GetInstance().GetVideoFileNamingAlgorithm()) filepath := manager.GetInstance().Paths.Scene.GetStreamPath(scene.Path, sceneHash) diff --git a/ui/v2.5/src/components/Scenes/SceneDetails/SceneFileInfoPanel.tsx b/ui/v2.5/src/components/Scenes/SceneDetails/SceneFileInfoPanel.tsx index 8cccfc425..b2edbfa93 100644 --- a/ui/v2.5/src/components/Scenes/SceneDetails/SceneFileInfoPanel.tsx +++ b/ui/v2.5/src/components/Scenes/SceneDetails/SceneFileInfoPanel.tsx @@ -306,12 +306,14 @@ export const SceneFileInfoPanel: React.FC = ( return ( <>
- + {props.scene.files.length > 0 && ( + + )} {renderFunscript()} {renderInteractiveSpeed()}