Commit 10710b3b469a68e0a4be76d78ebd880661e2727b
1 parent
3be5adc6
Exists in
master
and in
1 other branch
Corrige o jeito que nomeia os arquivos baixados
Evita problemas onde o nome do arquivo de vídeo seria: 1414172854715.mp4?e=0&b=e
Showing
1 changed file
with
12 additions
and
0 deletions
Show diff stats
helpers/files.js
| ... | ... | @@ -46,6 +46,12 @@ function downloadAndMoveVideo(folder, req, locals, callback) { |
| 46 | 46 | |
| 47 | 47 | // Nome do arquivo |
| 48 | 48 | var filename = req.body.video_url.substring(req.body.video_url.lastIndexOf('/') + 1); |
| 49 | + | |
| 50 | + // Tira os parâmetros HTTP | |
| 51 | + if (filename.lastIndexOf("?") !== -1) { | |
| 52 | + filename = filename.substring(0, filename.lastIndexOf("?")); | |
| 53 | + } | |
| 54 | + | |
| 49 | 55 | var path = folder + '/' + filename; |
| 50 | 56 | |
| 51 | 57 | // Salva o arquivo em disco |
| ... | ... | @@ -114,6 +120,12 @@ function downloadAndMoveSubtitle(folder, req, locals, callback) { |
| 114 | 120 | |
| 115 | 121 | // Nome do arquivo |
| 116 | 122 | var filename = req.body.legenda_url.substring(req.body.legenda_url.lastIndexOf('/') + 1); |
| 123 | + | |
| 124 | + // Tira os parâmetros HTTP | |
| 125 | + if (filename.lastIndexOf("?") !== -1) { | |
| 126 | + filename = filename.substring(0, filename.lastIndexOf("?")); | |
| 127 | + } | |
| 128 | + | |
| 117 | 129 | var path = folder + '/' + filename; |
| 118 | 130 | |
| 119 | 131 | // Salva o arquivo em disco | ... | ... |