Bugfix: failsafe join for images.

* Added failsafe join to only provide images that are bound to some photos.
This commit is contained in:
zegkljan 2022-08-14 13:13:13 +02:00
parent 19fc8e0322
commit 7b1c3cfc28

View File

@ -410,7 +410,7 @@ func (s *Server) getDataWithPhotos() (file *os.File, err error) {
return nil, fmt.Errorf("failed to write data zip entry: %w", err)
}
err = sqlitex.Exec(conn, "select id from feature_photos", func(stmt *sqlite.Stmt) error {
err = sqlitex.Exec(conn, "select id from feature_photos fp where exists (select 1 from features f where f.id = fp.feature_id)", func(stmt *sqlite.Stmt) error {
id := stmt.ColumnInt64(0)
blob, err := conn.OpenBlob("", "feature_photos", "thumbnail_contents", id, false)