「匿名ユーザーのファイルダウンロードを防止」が有効な場合、音声添付ファイルが機能しません

バグかどうかはわかりませんが、アップロードされたオーディオファイルの挙動に不整合が見られます。

昨日、当フォーラムの添付ファイルに mp3 形式を有効にし、自分宛てのプライベートメッセージでドラッグ&ドロップによるアップロードをテストしました。その際は期待通り、投稿内にプレーヤーがインライン表示されました。

しかし、今さっき同じように試したところ、ダウンロードリンクが表示されてしまいます。昨日と同じ操作(コンポーザーにファイルをドラッグ&ドロップ)を行ったつもりですが、結果が異なります。

@techAPJ の投稿によると、アップロードされたオーディオファイルの「ネイティブプレーヤー」がデフォルトになるはずとのことですが、合っていますでしょうか? — https://meta.discourse.org/t/playing-mp3-next-to-the-button-to-download-the-file/26944/29?u=bts

余談ですが、投稿を編集して生テキストを見ると、期待されるネイティブオーディオプレーヤーが生成されるのは以下の形式です。これは昨日、自分宛てのテスト PM にファイルを添付した際に得られたものです。

https://forum.troygrady.com/uploads/default/original/2X/3/38d861bfed1a26b23255bbd634263ff63fba1371.mp3

一方、今日改めて以前の PM に返信し、mp3 ファイルをドラッグしてアップロードすると、以下の形式が投稿に挿入され、インラインプレーヤーではなくダウンロードリンクが表示されます。

<a class="attachment" href="/uploads/default/original/2X/3/38d861bfed1a26b23255bbd634263ff63fba1371.mp3">Centipede - Backing Track.mp3</a> (2.3 MB)

Do you have the ‘prevent anons from downloading files’ Site Setting enabled? That setting will prevent an audio player from being created.

「いいね!」 2

Ah okay interesting! Thanks — yes I have that setting enabled as I do think it makes sense to prevent anons from downloading files.

But doesn’t seem like that setting should require disabling the audio player for logged in users?

Actually it appears that viewing as an anon user, the native audio player (both playback + download) is disabled anyway even using the raw embed URL rather than wrapping in the <a class="attachment"> tag.

E.g. the last post here, when I’m logged in I can play back and download the one-minute audio file, but viewing as anon it just appears as a non-functional player (no playback or download link):

Short term I guess I can turn off prevent anons from downloading files since for now it’s more just a minor preventative measure and I think it’s more important for audio playback to work correctly.

Also might be kinda fine to just have the behavior in the post linked above (showing disabled player) rather than not show player at all, when that prevent anons from downloading files is on. Or long term maybe Discourse could add a built in (but still super simple) audio player overriding the browser default but allowing more control over display / download settings.

(Assuming no other changes, for now perhaps a tip in that setting would help; to me very unintuitive that a setting re: download permissions would affect the inline audio player!)