Skip to content

Commit

Permalink
Fix VTT format (#1381)
Browse files Browse the repository at this point in the history
* Fix VTT format

The VTT file should have had a blank line after the first line, it parses successfully in https://w3c.github.io/webvtt.js/parser.html now

* Add url to log line to make debugging easier
  • Loading branch information
mjh1 authored Sep 12, 2024
1 parent b4097be commit d6858a1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions middleware/gating.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func (h *GatingHandler) GatingCheck(next httprouter.Handle) httprouter.Handle {

playbackAccessControlAllowed, err := h.AccessControl.IsAuthorized(req.Context(), playbackID, &payload)
if err != nil {
log.LogError(requestID, "unable to get playback access control info", err, "playbackID", playbackID, "accessKey", accessKey, "jwt", jwt)
log.LogError(requestID, "unable to get playback access control info", err, "playbackID", playbackID, "accessKey", accessKey, "jwt", jwt, "url", req.URL.Redacted())
if errors.Is(err, catErrs.InvalidJWT) {
deny(params.ByName("file"), w)
} else {
Expand All @@ -72,7 +72,7 @@ func (h *GatingHandler) GatingCheck(next httprouter.Handle) httprouter.Handle {
}

if !playbackAccessControlAllowed {
log.Log(requestID, "playback access control denied", "playbackID", playbackID, "accessKey", accessKey, "jwt", jwt)
log.Log(requestID, "playback access control denied", "playbackID", playbackID, "accessKey", accessKey, "jwt", jwt, "url", req.URL.Redacted())
deny(params.ByName("file"), w)
return
}
Expand Down
2 changes: 1 addition & 1 deletion thumbnails/thumbnails.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func GenerateThumbsVTT(requestID string, input string, output *url.URL) error {
const layout = "15:04:05.000"
outputLocation := output.JoinPath(outputDir)
builder := &bytes.Buffer{}
_, err = builder.WriteString("WEBVTT\n")
_, err = builder.WriteString("WEBVTT\n\n")
if err != nil {
return err
}
Expand Down
1 change: 1 addition & 0 deletions thumbnails/thumbnails_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ func testGenerateThumbsRun(t *testing.T, outDir, input string) {
require.NoError(t, err)

expectedVtt := `WEBVTT
00:00:00.000 --> 00:00:10.000
keyframes_0.png
Expand Down

0 comments on commit d6858a1

Please sign in to comment.