Skip to content

A self-hosted media server and file management system

fix: subtitle path fails if uuid param is malformed

aminnausinfd25697eb15c
diff --git a/app/Http/Controllers/Api/V1/Metadata/SubtitleController.php b/app/Http/Controllers/Api/V1/Metadata/SubtitleController.php
index 34101d41..c41b7945 100644
--- a/app/Http/Controllers/Api/V1/Metadata/SubtitleController.php
+++ b/app/Http/Controllers/Api/V1/Metadata/SubtitleController.php
@@ -18,11 +18,13 @@ class SubtitleController extends Controller {
* then when requested by stream or file type, if the exact requested file matches an existing one, return that but if not probe again,
* and for each found stream, extract it, write to a file and update the row in the subtitle file, and then convert it to the requested format and return that file
* on subsequent requests, a matching file (usually vtt) will already exist and get returned directly
+ *
+ * Route: /data/subtitles/{metadata:uuid}/{track}.{format?}
*/
public function show(
Request $request,
Metadata $metadata,
- int $track = 2, // track number to specify file like 2.vtt or 3.vtt
+ int $track, // track number to specify file like 2.vtt or 3.vtt
string $format = 'vtt'
) {
// TODO: Log activity from request (requires future activity feature)
diff --git a/routes/web.php b/routes/web.php
index 5ce6af9b..75605ef3 100755
--- a/routes/web.php
+++ b/routes/web.php
@@ -44,7 +44,7 @@ Route::get('/metadata/{path}', function (string $path) {
);
})->where('path', '.*');
-Route::get('/data/subtitles/{metadata:uuid}/{track}.{format?}', [SubtitleController::class, 'show'])->where('format', 'vtt|srt|json');
+Route::get('/data/subtitles/{metadata:uuid}/{track}.{format?}', [SubtitleController::class, 'show'])->whereUuid('metadata')->where('format', 'vtt|srt|ass|json');
Route::get('/data/{path}', function (string $path) {
$path = 'data/' . $path;