I'm working on a plugin that filters out a specific file type and relocates them to a different folder.
Everything works as I want except for two issues that I expect are approximately the same solution.
Since uploadFile fires on all files, I need to do an early filter against the extension/mimetype and exit out on a non-match. When I do so, I am firing the callback with (null, data ) where data is the past object for the filter then returning. The resulting link that shows up in the message has a bad URL.
Similarly, when it passes the extension check, it throws an exception due to the uploaded temp file being moved by my plugin.
I assume in both cases this is an issue with what need to get sent back when the filter wraps up its business for the rest of the "upload" flow. Looking at uploads.js hasn't helped me parse it out.
Looking at the imgur plugin has me more confused than understanding.
Anyone know what needs to occur here?