ianstormtaylor / slate-plugins

A set of my personal Slate editor plugins, in a monorepo.
https://slate-plugins.netlify.com
Other
248 stars 68 forks source link

slate-drop-or-paste-images: Error is thrown if file has no extension #42

Open tommoor opened 5 years ago

tommoor commented 5 years ago

Do you want to request a feature or report a bug?

Bug 🐛

What's the current behavior?

What's the expected behavior?

wmertens commented 5 years ago

The problem is that ext can become undefined at https://github.com/ianstormtaylor/slate-plugins/blob/d057c71e94a9396eba76a4c50d9d0cd840e8b1e9/packages/slate-drop-or-paste-images/src/index.js#L109

But that code is bad anyway, it won't handle .foo.jpg or bar.old.jpg. Better to use a regex like /([^.]+)$/.exec(name)