From 064d6f86158027c7e74b0c5c070c352f58ec51c1 Mon Sep 17 00:00:00 2001 From: "N.Yanbe" Date: Sat, 16 Jun 2018 18:29:41 +0900 Subject: [PATCH] Fix AWS S3 related issues. (#757) * Avoid an error from MySQL, "Column cannot be null". Similar to this issue: https://stackoverflow.com/questions/43860634/laravel-5-4-upgrade-integrity-constraint-violation-column-cannot-be-null * Clears the media cache after storing a new song. --- app/Http/Controllers/API/ObjectStorage/S3/SongController.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/API/ObjectStorage/S3/SongController.php b/app/Http/Controllers/API/ObjectStorage/S3/SongController.php index fec26b61..090d6fec 100644 --- a/app/Http/Controllers/API/ObjectStorage/S3/SongController.php +++ b/app/Http/Controllers/API/ObjectStorage/S3/SongController.php @@ -40,11 +40,12 @@ class SongController extends Controller 'album_id' => $album->id, 'artist_id' => $artist->id, 'title' => trim(array_get($tags, 'title', '')), - 'length' => array_get($tags, 'duration', 0), + 'length' => array_get($tags, 'duration', 0) ?: 0, 'track' => (int) array_get($tags, 'track'), - 'lyrics' => array_get($tags, 'lyrics', ''), + 'lyrics' => array_get($tags, 'lyrics', '') ?: '', 'mtime' => time(), ]); + event(new LibraryChanged()); return response()->json($song); }