Skip to content

Commit

Permalink
Refactoring posters endpoint to always attempt to fetch desired version
Browse files Browse the repository at this point in the history
  • Loading branch information
boggydigital committed Dec 12, 2024
1 parent fc2fd1d commit f89ce09
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions rest/get_poster.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"io"
"net/http"
"os"
"strings"
"time"
)

Expand Down Expand Up @@ -43,15 +42,12 @@ func GetPoster(w http.ResponseWriter, r *http.Request) {

// attempt to fetch posters from the origin if they don't exist locally
// unless that's a URL file
if _, err := os.Stat(absPosterFilename); os.IsNotExist(err) &&
!strings.Contains(videoId, youtube_urls.DefaultVideoExt) {
if _, err := os.Stat(absPosterFilename); err != nil {
if err := yeti.GetPosters(videoId, dolo.DefaultClient, false, q); err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
}

if _, err := os.Stat(absPosterFilename); err == nil {
} else {
w.Header().Add("Cache-Control", "max-age=31536000")
http.ServeFile(w, r, absPosterFilename)
return
Expand Down

0 comments on commit f89ce09

Please sign in to comment.