awcodes / filament-tiptap-editor

A Rich Text Editor plugin for Filament Forms.
MIT License
278 stars 77 forks source link

Using plugin with s3 as disk stores wrong path #361

Closed amiranagram closed 5 months ago

amiranagram commented 5 months ago

Filament Version

v3.2.63

Plugin Version

v3.3.0

PHP Version

PHP 8.3.0

Problem description

When using s3 disk, plugin saves the wrong path. With following config:

TiptapEditor::make('content')
    ->label(__('Content'))
    ->required()
    ->disk('s3')
    ->directory('blog')
    ->output(TiptapOutput::Html)
    ->columnSpan([
        'sm' => 2,
    ]),

just uploading an image and saving the resource produces the following content:

content: "<p><img src="/https://bucket.fra1.digitaloceanspaces.com/blog/3608d17f-26a4-4099-bbf1-902f103d00bf.png" alt="image" width="1386" height="93"></p>",

Notice the leading / which causes browsers to prepend app domain to it.

Expected behavior

Save content as:

content: "<p><img src="https://bucket.fra1.digitaloceanspaces.com/blog/3608d17f-26a4-4099-bbf1-902f103d00bf.png" alt="image" width="1386" height="93"></p>",

Steps to reproduce

Have an s3 bucket, configure it in the Laravel app, and use s3 as file upload disk in TipTap plugin.

Reproduction repository

No response

Relevant log output

No response

awcodes commented 5 months ago

Publish the config and set 'use_relative_paths' => false,

amiranagram commented 5 months ago

My bad, thanks for the prompt response.