Fix branding logo URL path

The current method adds an additional slash to the URL which results in the logo request producing a 404 error on for Storage drivers like S3 and GCS that don't automatically collapse additional forward slashes into single slashes.

E.g. with the current code my logo URL renders like `https://storage.googleapis.com/mybucketname/public//setting-logo-Al0aKMhmYz.svg` (note the double slash after "public") when instead it should render like `https://storage.googleapis.com/mybucketname/public/setting-logo-Al0aKMhmYz.svg`

For a local driver this should work fine since webservers handle the additional slashes case, but for key-based storage this 404s.

Thanks for your work on Snipe-It, seems like a good system so far!
This commit is contained in:
Jethro Nederhof 2021-07-28 14:55:34 +10:00 committed by GitHub
parent 9a5d9eafeb
commit d8fdd1b408
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -108,14 +108,14 @@
@if ($snipeSettings->brand == '3')
<a class="logo navbar-brand no-hover" href="{{ url('/') }}">
@if ($snipeSettings->logo!='')
<img class="navbar-brand-img" src="{{ Storage::disk('public')->url('/').e($snipeSettings->logo) }}" alt="{{ $snipeSettings->site_name }} logo">
<img class="navbar-brand-img" src="{{ Storage::disk('public')->url($snipeSettings->logo) }}" alt="{{ $snipeSettings->site_name }} logo">
@endif
{{ $snipeSettings->site_name }}
</a>
@elseif ($snipeSettings->brand == '2')
<a class="logo navbar-brand no-hover" href="{{ url('/') }}">
@if ($snipeSettings->logo!='')
<img class="navbar-brand-img" src="{{ Storage::disk('public')->url('/').e($snipeSettings->logo) }}" alt="{{ $snipeSettings->site_name }} logo">
<img class="navbar-brand-img" src="{{ Storage::disk('public')->url($snipeSettings->logo) }}" alt="{{ $snipeSettings->site_name }} logo">
@endif
<span class="sr-only">{{ $snipeSettings->site_name }}</span>
</a>