mirror of
https://github.com/ad-aures/castopod.git
synced 2026-04-14 03:57:45 +02:00
fix(platforms): trim platform url before validation and storage
--> Having a URL with spaces in the beginning or end would cause the platform to be deleted
This commit is contained in:
parent
c94bd7cf81
commit
259fe5f697
2 changed files with 10 additions and 2 deletions
|
|
@ -145,6 +145,8 @@ class PlatformModel extends Model
|
|||
|
||||
/**
|
||||
* @param mixed[] $podcastsPlatformsData
|
||||
*
|
||||
* @return int|false Number of rows inserted or FALSE on failure
|
||||
*/
|
||||
public function savePodcastPlatforms(
|
||||
int $podcastId,
|
||||
|
|
@ -165,6 +167,11 @@ class PlatformModel extends Model
|
|||
|
||||
$this->db->query($deleteJoinQuery, [$podcastId, $platformType]);
|
||||
|
||||
if ($podcastsPlatformsData === []) {
|
||||
// no rows inserted
|
||||
return 0;
|
||||
}
|
||||
|
||||
return $this->db
|
||||
->table('podcasts_platforms')
|
||||
->insertBatch($podcastsPlatformsData);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue