Fix album downloads when running production
This commit is contained in:
parent
68b6a49638
commit
7799674b74
|
@ -36,8 +36,15 @@ func RegisterDownloadRoutes(db *gorm.DB, router *mux.Router) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var mediaWhereQuery string
|
||||||
|
if db.Dialector.Name() == "postgres" {
|
||||||
|
mediaWhereQuery = "\"Media\".album_id = ?"
|
||||||
|
} else {
|
||||||
|
mediaWhereQuery = "Media.album_id = ?"
|
||||||
|
}
|
||||||
|
|
||||||
var mediaURLs []*models.MediaURL
|
var mediaURLs []*models.MediaURL
|
||||||
if err := db.Joins("Media").Where("media.album_id = ?", album.ID).Where("media_urls.purpose IN (?)", mediaPurposeList).Find(&mediaURLs).Error; err != nil {
|
if err := db.Joins("Media").Where(mediaWhereQuery, album.ID).Where("media_urls.purpose IN (?)", mediaPurposeList).Find(&mediaURLs).Error; err != nil {
|
||||||
w.WriteHeader(http.StatusInternalServerError)
|
w.WriteHeader(http.StatusInternalServerError)
|
||||||
w.Write([]byte("internal server error"))
|
w.Write([]byte("internal server error"))
|
||||||
return
|
return
|
||||||
|
|
|
@ -22,7 +22,9 @@ clientsClaim()
|
||||||
// Their URLs are injected into the manifest variable below.
|
// Their URLs are injected into the manifest variable below.
|
||||||
// This variable must be present somewhere in your service worker file,
|
// This variable must be present somewhere in your service worker file,
|
||||||
// even if you decide not to use precaching. See https://cra.link/PWA
|
// even if you decide not to use precaching. See https://cra.link/PWA
|
||||||
precacheAndRoute(self.__WB_MANIFEST)
|
precacheAndRoute(self.__WB_MANIFEST, {
|
||||||
|
ignoreURLParametersMatching: [/^\/api\/.*/],
|
||||||
|
})
|
||||||
|
|
||||||
// Set up App Shell-style routing, so that all navigation requests
|
// Set up App Shell-style routing, so that all navigation requests
|
||||||
// are fulfilled with your index.html shell. Learn more at
|
// are fulfilled with your index.html shell. Learn more at
|
||||||
|
|
Loading…
Reference in New Issue