Skip to content

Commit

Permalink
Merge pull request #11836 from snipe/fixes/500_if_image_is_missing
Browse files Browse the repository at this point in the history
Fixed 500 error if uploaded file is missing from asset view
  • Loading branch information
snipe authored Sep 15, 2022
2 parents 3eab44f + 62ad3fa commit 0f777b3
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions resources/views/hardware/view.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -1198,18 +1198,22 @@ class="table table-striped snipe-table"
@endif
</td>
<td>
@if (Storage::exists('private_uploads/assets/'.$file->filename))
{{ $file->filename }}
@else
<del>{{ $file->filename }}</del>
@endif
</td>
<td data-value="{{ @Storage::size('private_uploads/assets/'.$file->filename) }}">
{{ @Helper::formatFilesizeUnits(Storage::size('private_uploads/assets/'.$file->filename)) }}
<td data-value="{{ (Storage::exists('private_uploads/assets/'.$file->filename) ? Storage::size('private_uploads/assets/'.$file->filename) : '') }}">
{{ @Helper::formatFilesizeUnits(Storage::exists('private_uploads/assets/'.$file->filename) ? Storage::size('private_uploads/assets/'.$file->filename) : '') }}
</td>
<td>
@if ($file->note)
{{ $file->note }}
@endif
</td>
<td>
@if ($file->filename)
@if (($file->filename) && (Storage::exists('private_uploads/assets/'.$file->filename)))
<a href="{{ route('show/assetfile', [$asset->id, $file->id]) }}" class="btn btn-default">
<i class="fas fa-download" aria-hidden="true"></i>
</a>
Expand Down Expand Up @@ -1291,18 +1295,22 @@ class="table table-striped snipe-table"
@endif
</td>
<td>
{{ $file->filename }}
@if (Storage::exists('private_uploads/assetmodels/'.$file->filename))
{{ $file->filename }}
@else
<del>{{ $file->filename }}</del>
@endif
</td>
<td data-value="{{ Storage::size('private_uploads/assetmodels/'.$file->filename) }}">
{{ Helper::formatFilesizeUnits(Storage::size('private_uploads/assetmodels/'.$file->filename)) }}
<td data-value="{{ (Storage::exists('private_uploads/assetmodels/'.$file->filename) ? Storage::size('private_uploads/assetmodels/'.$file->filename) : '') }}">
{{ Helper::formatFilesizeUnits(@Storage::size('private_uploads/assetmodels/'.$file->filename)) }}
</td>
<td>
@if ($file->note)
{{ $file->note }}
@endif
</td>
<td>
@if ($file->filename)
@if (($file->filename) && (Storage::exists('private_uploads/assetmodels/'.$file->filename)))
<a href="{{ route('show/modelfile', [$asset->model->id, $file->id]) }}" class="btn btn-default">
<i class="fas fa-download" aria-hidden="true"></i>
</a>
Expand Down

0 comments on commit 0f777b3

Please sign in to comment.