fix 1.2.8 - logo app
This commit is contained in:
@@ -148,5 +148,15 @@ php artisan config:clear
|
|||||||
- Richiama `window.calendar.refetchEvents()` per aggiornare la vista FullCalendar
|
- Richiama `window.calendar.refetchEvents()` per aggiornare la vista FullCalendar
|
||||||
- Esposto `window.calendar` globalmente per accesso dall'handler sync
|
- Esposto `window.calendar` globalmente per accesso dall'handler sync
|
||||||
|
|
||||||
|
## 2026-06-08 — Fix logo non visibile su installazione remota
|
||||||
|
|
||||||
|
**Problema**: Il logo uploadato non veniva visualizzato su installazioni remote, pur salvandosi correttamente su disco.
|
||||||
|
|
||||||
|
**Root cause**: `getLogoPath()` e `getLogoSmallPath()` in `AppSetting.php` usavano `file_exists(public_path('storage/' . $path))` per verificare l'esistenza del file prima di restituire l'URL. Questo controllo dipendeva dal symlink `public/storage → storage/app/public`. Su installazioni remote dove il symlink era assente o mal configurato, `file_exists` restituiva `false` → metodo restituiva `null` → logo non mostrato.
|
||||||
|
|
||||||
|
**Fix**:
|
||||||
|
1. **`app/Models/AppSetting.php`**: Sostituito `file_exists(public_path('storage/' . $path))` con `Storage::disk('public')->exists($path)` e `asset('storage/' . $path)` con `Storage::disk('public')->url($path)`. Il controllo ora avviene direttamente su `storage/app/public/` (disk root), bypassando il symlink.
|
||||||
|
2. **`app/Http/Controllers/ImpostazioniController.php`**: In `uploadLogo()`, aggiunta creazione automatica del symlink `public/storage → storage/app/public` se mancante, per garantire che il browser possa servire l'immagine.
|
||||||
|
|
||||||
## Prossimi Passi
|
## Prossimi Passi
|
||||||
- *(nessuno — in attesa di nuove richieste)*
|
- *(nessuno — in attesa di nuove richieste)*
|
||||||
|
|||||||
@@ -398,6 +398,15 @@ class ImpostazioniController extends Controller
|
|||||||
$settings->save();
|
$settings->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$linkPath = public_path('storage');
|
||||||
|
if (!file_exists($linkPath) && !is_link($linkPath)) {
|
||||||
|
try {
|
||||||
|
symlink(storage_path('app/public'), $linkPath);
|
||||||
|
} catch (\Throwable $e) {
|
||||||
|
Log::warning('Impossibile creare symlink storage: ' . $e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return redirect('/impostazioni#logo')->with('success', 'Logo caricato con successo.');
|
return redirect('/impostazioni#logo')->with('success', 'Logo caricato con successo.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+14
-12
@@ -5,7 +5,9 @@ declare(strict_types=1);
|
|||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Support\Facades\File;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
|
||||||
class AppSetting extends Model
|
class AppSetting extends Model
|
||||||
{
|
{
|
||||||
@@ -107,38 +109,38 @@ class AppSetting extends Model
|
|||||||
|
|
||||||
public function getLogoUrlInstance(): ?string
|
public function getLogoUrlInstance(): ?string
|
||||||
{
|
{
|
||||||
if ($this->logo && file_exists(public_path('storage/' . $this->logo))) {
|
if ($this->logo && Storage::disk('public')->exists($this->logo)) {
|
||||||
return asset('storage/' . $this->logo);
|
return Storage::disk('public')->url($this->logo);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLogoSmallUrlInstance(): ?string
|
public function getLogoSmallUrlInstance(): ?string
|
||||||
{
|
{
|
||||||
if ($this->logo_small && file_exists(public_path('storage/' . $this->logo_small))) {
|
if ($this->logo_small && Storage::disk('public')->exists($this->logo_small)) {
|
||||||
return asset('storage/' . $this->logo_small);
|
return Storage::disk('public')->url($this->logo_small);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLogoPath(): ?string
|
public function getLogoPath(): ?string
|
||||||
{
|
{
|
||||||
if ($this->logo_path && file_exists(public_path('storage/' . $this->logo_path))) {
|
if ($this->logo_path && Storage::disk('public')->exists($this->logo_path)) {
|
||||||
return asset('storage/' . $this->logo_path);
|
return Storage::disk('public')->url($this->logo_path);
|
||||||
}
|
}
|
||||||
if ($this->logo && file_exists(public_path('storage/' . $this->logo))) {
|
if ($this->logo && Storage::disk('public')->exists($this->logo)) {
|
||||||
return asset('storage/' . $this->logo);
|
return Storage::disk('public')->url($this->logo);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLogoSmallPath(): ?string
|
public function getLogoSmallPath(): ?string
|
||||||
{
|
{
|
||||||
if ($this->logo_small_path && file_exists(public_path('storage/' . $this->logo_small_path))) {
|
if ($this->logo_small_path && Storage::disk('public')->exists($this->logo_small_path)) {
|
||||||
return asset('storage/' . $this->logo_small_path);
|
return Storage::disk('public')->url($this->logo_small_path);
|
||||||
}
|
}
|
||||||
if ($this->logo_small && file_exists(public_path('storage/' . $this->logo_small))) {
|
if ($this->logo_small && Storage::disk('public')->exists($this->logo_small)) {
|
||||||
return asset('storage/' . $this->logo_small);
|
return Storage::disk('public')->url($this->logo_small);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user