fix: link old
This commit is contained in:
@@ -178,8 +178,20 @@ class DeviceController extends Controller
|
||||
|
||||
$row = $device->photos()->whereKey($photo)->firstOrFail();
|
||||
abort_unless($origin->ensureLocal($row), 404);
|
||||
$abs = Storage::disk('local')->path($row->path);
|
||||
$out = $preview->payload($abs, (string) $device->device_id, (string) ($row->sha256 ?: ''));
|
||||
$abs = Storage::disk('local')->path((string) $row->path);
|
||||
try {
|
||||
$out = $preview->payload($abs, (string) $device->device_id, (string) ($row->sha256 ?: ''));
|
||||
} catch (\Throwable $e) {
|
||||
Log::warning('photo preview failed', [
|
||||
'photo_id' => $row->id,
|
||||
'path' => $row->path,
|
||||
'error' => $e->getMessage(),
|
||||
]);
|
||||
abort(404);
|
||||
}
|
||||
if (($out['bytes'] ?? '') === '') {
|
||||
abort(404);
|
||||
}
|
||||
if ((string) request()->query('seen', '') === '1') {
|
||||
$this->markPhotoRead($row);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user