Fixed: Slug filename before saving it
continuous-integration/drone/push Build is failing Details

This commit is contained in:
philipp lang 2022-03-24 20:56:43 +01:00
parent 8eb5098c6e
commit 4e19138724
1 changed files with 6 additions and 4 deletions

View File

@ -10,8 +10,8 @@ use Zoomyboy\Social\Exceptions\SocialException;
use Zoomyboy\Social\Models\Page;
use Zoomyboy\Social\Models\Setting;
abstract class SocialService {
abstract class SocialService
{
protected $page;
protected $media;
@ -50,7 +50,8 @@ abstract class SocialService {
return Page::where('type', $this->getType())->get();
}
public function clear() {
public function clear()
{
$this->page->delete();
}
@ -73,6 +74,8 @@ abstract class SocialService {
throw new SocialException('No real filename for storage given in "'.$source.'"');
}
$filename = str_slug(pathinfo($filename, PATHINFO_FILENAME)).'.'.pathinfo($filename, PATHINFO_EXTENSION);
$file = $this->page->mediaPath.$filename;
if (!$this->media->exists($file)) {
@ -101,5 +104,4 @@ abstract class SocialService {
$this->cleanOutdated();
}
}