Open Stelikas opened 3 years ago
The issue is probably in Voyager::image i had a function which gets the user thumbnail
public function getThumbnailAttribute()
{
$out = '';
if($this->image){
$out = asset(Voyager::image($this->thumbnail('xs')));
$out = str_replace('%5C', '/', $out);
} else {
$out = asset('assets/images/service-placeholder.svg');
}
return $out;
}
Using str_replace fixed one of the many issues, the issue is not resolved yet of course, that only fixed it for one of my views, in admin panel the issue persists.
*Update I fixed the issue inside Voyager.php inside function image, now everything works just as expected.
public function image($file, $default = '')
{
if (!empty($file)) {
$out = str_replace('\\', '/', Storage::disk(config('voyager.storage.disk'))->url($file));
$out = str_replace('%5C', '/', $out);
return $out;
}
return $default;
}
I've been having the same issue #5230 Voyager encodes / to %5C with Laravel: v7.30.4 Voyager: v1.4 PHP: 7.4
I wonder If/How i should change DIRECTORY_SEPARATOR in this function:
protected function generatePath() { return $this->slug.DIRECTORY_SEPARATOR.date('FY').DIRECTORY_SEPARATOR; }
In:
voyager/src/Http/Controllers/ContentTypes/File.php
Any help would be much appreciated
I can confirm that using s3 as storage driver the %5C issue occurs.
I solved for the moment with the workaround up here by @Stelikas .
Hoping you can fix the problem. Thanks
Version information
Description
I connected S3 DigitalOcean Spaces with my Laravel App using Voyager as an admin panel, the upload works fine although it encodes the forward slash into backslash as "%5C" and i get a 404 error, although when i change manually the link from "%5C" to "/" it worked, Voyager Media in admin panel displays the images just fine
Steps To Reproduce
Steps to reproduce the behavior: