Skip to content

Commit

Permalink
Return HTTP 204 when no subtitles found
Browse files Browse the repository at this point in the history
  • Loading branch information
tympanix committed Mar 8, 2018
1 parent 4bab928 commit 47f6c77
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion api/api_subtitle.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,13 @@ func (a *API) downloadSubtitles(w http.ResponseWriter, r *http.Request) interfac
if err != nil {
return Error(err, http.StatusBadRequest)
}
_, err = a.DownloadSubtitles(media, langs, ioutil.Discard)
num, err := a.DownloadSubtitles(media, langs, ioutil.Discard)
if err != nil {
return Error(err, http.StatusBadRequest)
}
if num <= 0 {
return Error(errors.New("no subtitles found"), http.StatusNoContent)
}
files, err := a.fileList(folder)
if err != nil {
return Error(err, http.StatusBadRequest)
Expand Down

0 comments on commit 47f6c77

Please sign in to comment.