I spent some time trying to figure this out and didn’t find an obvious way to do it. What makes sense to me is reopening the composer-editor component and making the changes there. It would be possible to override the _bindUploadTarget function that calls getUploadMarkdown, but that seems like a bad idea.
If getUploadMarkdown was called inside of a function in composer-editor.js.es6, it would be possible to do something like this in a site customization - for testing this I removed wav files from the audio file list:
// composer-editor.js.es6
...
_getUploadMarkdown(upload) {
return getUploadMarkdown(upload);
},
...
<script>
var ComposerEditor = require('discourse/components/composer-editor').default;
var uploadLocation = require('discourse/lib/utilities').uploadLocation;
ComposerEditor.reopen({
_getUploadMarkdown: function(upload) {
if (!Discourse.SiteSettings.prevent_anons_from_downloading_files && (/\.(wav)$/i).test(upload.original_filename)) {
return uploadLocation(upload.url);
}
return this._super(upload);
}
});
</script>
Maybe there’s a way to do something similar by doing something directly with the getUploadMarkdown import.