mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-24 05:04:07 -08:00
Merge pull request #12454 from snipe/fixes/fixed_500_when_userfile_does_not_exisy
Handle missing userfiles more gracefully
This commit is contained in:
commit
2d3318feb6
|
@ -390,7 +390,8 @@ return [
|
|||
'start_date' => 'Start Date',
|
||||
'end_date' => 'End Date',
|
||||
'alt_uploaded_image_thumbnail' => 'Uploaded thumbnail',
|
||||
'placeholder_kit' => 'Select a kit'
|
||||
'placeholder_kit' => 'Select a kit',
|
||||
'file_not_found' => 'File not found',
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -869,16 +869,19 @@
|
|||
</td>
|
||||
<td>
|
||||
@if ($file->filename)
|
||||
@if ( Helper::checkUploadIsImage($file->get_src('users')))
|
||||
@if ((Storage::exists('private_uploads/users/'.$file->filename)) && ( Helper::checkUploadIsImage($file->get_src('users'))))
|
||||
<a href="{{ route('show/userfile', ['userId' => $user->id, 'fileId' => $file->id, 'download' => 'false']) }}" data-toggle="lightbox" data-type="image"><img src="{{ route('show/userfile', ['userId' => $user->id, 'fileId' => $file->id]) }}" class="img-thumbnail" style="max-width: 50px;"></a>
|
||||
@else
|
||||
<i class="fa fa-times text-danger" aria-hidden="true"></i>
|
||||
{{ trans('general.file_not_found') }}
|
||||
@endif
|
||||
@endif
|
||||
</td>
|
||||
<td>
|
||||
{{ $file->filename }}
|
||||
</td>
|
||||
<td>
|
||||
{{ Helper::formatFilesizeUnits(Storage::size('private_uploads/users/'.$file->filename)) }}
|
||||
<td data-value="{{ (Storage::exists('private_uploads/users/'.$file->filename)) ? Storage::size('private_uploads/users/'.$file->filename) : '' }}">
|
||||
{{ (Storage::exists('private_uploads/users/'.$file->filename)) ? Helper::formatFilesizeUnits(Storage::size('private_uploads/users/'.$file->filename)) : '' }}
|
||||
</td>
|
||||
|
||||
<td>
|
||||
|
@ -888,10 +891,12 @@
|
|||
</td>
|
||||
<td>
|
||||
@if ($file->filename)
|
||||
<a href="{{ route('show/userfile', [$user->id, $file->id]) }}" class="btn btn-default">
|
||||
<i class="fas fa-download" aria-hidden="true"></i>
|
||||
<span class="sr-only">{{ trans('general.download') }}</span>
|
||||
</a>
|
||||
@if ((Storage::exists('private_uploads/users/'.$file->filename)) && ( Helper::checkUploadIsImage($file->get_src('users'))))
|
||||
<a href="{{ route('show/userfile', [$user->id, $file->id]) }}" class="btn btn-default">
|
||||
<i class="fas fa-download" aria-hidden="true"></i>
|
||||
<span class="sr-only">{{ trans('general.download') }}</span>
|
||||
</a>
|
||||
@endif
|
||||
@endif
|
||||
</td>
|
||||
<td>{{ $file->created_at }}</td>
|
||||
|
|
Loading…
Reference in a new issue