projects
/
oweals
/
peertube.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
49919ca
)
Correctly fix subtitles import
author
Chocobozzz
<me@florianbigard.com>
Wed, 17 Jun 2020 07:42:00 +0000
(09:42 +0200)
committer
Chocobozzz
<me@florianbigard.com>
Wed, 17 Jun 2020 07:42:00 +0000
(09:42 +0200)
server/helpers/youtube-dl.ts
patch
|
blob
|
history
diff --git
a/server/helpers/youtube-dl.ts
b/server/helpers/youtube-dl.ts
index 2014aab0a486ae5f0007bbb35c638594e6f6a95c..bb593095205223d0f618ddcc8ef88b5d6c7b16f5 100644
(file)
--- a/
server/helpers/youtube-dl.ts
+++ b/
server/helpers/youtube-dl.ts
@@
-67,17
+67,16
@@
function getYoutubeDLSubs (url: string, opts?: object): Promise<YoutubeDLSubs> {
const subtitles = files.reduce((acc, filename) => {
const matched = filename.match(/\.([a-z]{2})\.(vtt|ttml)/i)
-
- if (matched[1]) {
- return [
- ...acc,
- {
- language: matched[1],
- path: join(cwd, filename),
- filename
- }
- ]
- }
+ if (!matched || !matched[1]) return acc
+
+ return [
+ ...acc,
+ {
+ language: matched[1],
+ path: join(cwd, filename),
+ filename
+ }
+ ]
}, [])
return res(subtitles)