Skip to content

Take control over your live stream video by running it yourself. Streaming + chat out of the box.

Cleanup some warnings

Gabe Kangase71d0a112f84
diff --git a/controllers/images.go b/controllers/images.go
index 3fc1e3d63e..6ea3eadf37 100644
--- a/controllers/images.go
+++ b/controllers/images.go
@@ -8,6 +8,11 @@ import (
"github.com/owncast/owncast/utils"
)
+const (
+ contentTypeJPEG = "image/jpeg"
+ contentTypeGIF = "image/gif"
+)
+
// GetThumbnail will return the thumbnail image as a response.
func GetThumbnail(w http.ResponseWriter, r *http.Request) {
imageFilename := "thumbnail.jpg"
@@ -28,9 +33,8 @@ func GetThumbnail(w http.ResponseWriter, r *http.Request) {
return
}
- contentType := "image/jpeg"
cacheTime := utils.GetCacheDurationSecondsForPath(imagePath)
- writeBytesAsImage(imageBytes, contentType, w, cacheTime)
+ writeBytesAsImage(imageBytes, contentTypeJPEG, w, cacheTime)
}
// GetPreview will return the preview gif as a response.
@@ -53,7 +57,6 @@ func GetPreview(w http.ResponseWriter, r *http.Request) {
return
}
- contentType := "image/jpeg"
cacheTime := utils.GetCacheDurationSecondsForPath(imagePath)
- writeBytesAsImage(imageBytes, contentType, w, cacheTime)
+ writeBytesAsImage(imageBytes, contentTypeGIF, w, cacheTime)
}
diff --git a/core/data/config.go b/core/data/config.go
index 0266699818..3202bc0307 100644
--- a/core/data/config.go
+++ b/core/data/config.go
@@ -1,7 +1,6 @@
package data
import (
- "errors"
"os"
"path/filepath"
"sort"
@@ -12,6 +11,7 @@ import (
"github.com/owncast/owncast/models"
"github.com/owncast/owncast/static"
"github.com/owncast/owncast/utils"
+ "github.com/pkg/errors"
log "github.com/sirupsen/logrus"
)
@@ -587,9 +587,11 @@ func VerifySettings() error {
if !utils.DoesFileExists(filepath.Join(config.DataDirectory, logoPath)) {
log.Traceln(logoPath, "not found in the data directory. copying a default logo.")
logo := static.GetLogo()
- os.WriteFile(filepath.Join(config.DataDirectory, "logo.png"), logo, 0o600)
+ if err := os.WriteFile(filepath.Join(config.DataDirectory, "logo.png"), logo, 0o600); err != nil {
+ return errors.Wrap(err, "failed to write logo to disk")
+ }
if err := SetLogoPath("logo.png"); err != nil {
- log.Errorln("unable to set default logo to logo.svg", err)
+ return errors.Wrap(err, "failed to save logo filename")
}
}