Snapshot of main at 9f39a6e1e (2026-11-02)
This commit is contained in:
commit
6ccf1792d7
2580 files changed
+1040202
No files matched your search
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Namu\WireChat\Models\Attachment;
|
||||
|
||||
/**
|
||||
* Extends the WireChat Attachment model to override URL generation.
|
||||
*
|
||||
* The vendor model calls Storage::disk('local')->url() which throws because
|
||||
* the local disk has no web-accessible URL. We store files on the local disk
|
||||
* intentionally — access is gated through WireChatAttachmentController which
|
||||
* verifies the requester is a conversation participant before streaming the file.
|
||||
*/
|
||||
class WireChatAttachment extends Attachment
|
||||
{
|
||||
protected function generateUrl(?string $path): ?string
|
||||
{
|
||||
if (! $path) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Return the authenticated secure route instead of a direct storage URL.
|
||||
// The controller enforces participant-only access.
|
||||
$attachment = static::where('file_path', $path)->first();
|
||||
|
||||
if (! $attachment) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return route('wirechat.attachment.serve', ['attachment' => $attachment->id]);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user