awcodes / filament-tiptap-editor

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

Mime Types Instead of File Extensions #354

Closed nxgcx closed 4 months ago

nxgcx commented 6 months ago

Overview

This pull request changes a check from using everything after the dot in the URL as the extension to determine image validity, to checking the actual mime type as stored in the database. Under the current way of seeking a file extension in URL, the editor fails to insert an image if the image does not have a file extension at the end of the URL. It instead adds a link to the image. This is a bug for us with our particular use case and I hope that more well rounded method will prove to be useful for others as well.

Testing

Tested a variety of images and they seem to work fine.

awcodes commented 6 months ago

You're testing this with Curator, correct?

I'm thinking that it will break the default MediaAction, as it doesn't store a mime type anywhere to be referenced.

nxgcx commented 6 months ago

You're testing this with Curator, correct?

I'm thinking that it will break the default MediaAction, as it doesn't store a mime type anywhere to be referenced.

I suppose so, I will work on an alternative solution and update this PR.

awcodes commented 4 months ago

Closing this for now. Feel free to reopen if you find a solution.

Thanks.