Skip to content

Commit fd25697

Browse files
committed
fix: subtitle path fails if uuid param is malformed
1 parent 7cff454 commit fd25697

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

app/Http/Controllers/Api/V1/Metadata/SubtitleController.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,13 @@ public function __construct(protected SubtitleResolver $subtitleResolver) {}
1818
* then when requested by stream or file type, if the exact requested file matches an existing one, return that but if not probe again,
1919
* 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
2020
* on subsequent requests, a matching file (usually vtt) will already exist and get returned directly
21+
*
22+
* Route: /data/subtitles/{metadata:uuid}/{track}.{format?}
2123
*/
2224
public function show(
2325
Request $request,
2426
Metadata $metadata,
25-
int $track = 2, // track number to specify file like 2.vtt or 3.vtt
27+
int $track, // track number to specify file like 2.vtt or 3.vtt
2628
string $format = 'vtt'
2729
) {
2830
// TODO: Log activity from request (requires future activity feature)

routes/web.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
);
4545
})->where('path', '.*');
4646

47-
Route::get('/data/subtitles/{metadata:uuid}/{track}.{format?}', [SubtitleController::class, 'show'])->where('format', 'vtt|srt|json');
47+
Route::get('/data/subtitles/{metadata:uuid}/{track}.{format?}', [SubtitleController::class, 'show'])->whereUuid('metadata')->where('format', 'vtt|srt|ass|json');
4848

4949
Route::get('/data/{path}', function (string $path) {
5050
$path = 'data/' . $path;

0 commit comments

Comments
 (0)