Skip to content

Commit

Permalink
fix: Fix logical check on file extensions to not just ignore it when …
Browse files Browse the repository at this point in the history
…podcast server returns wrong headers
  • Loading branch information
chhoumann committed Mar 16, 2024
1 parent b9bbb8d commit 2c35e7a
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/downloadEpisode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,17 @@ export default async function downloadEpisodeWithNotice(
});

const fileExtension = await detectAudioFileExtension(blob);
if (!fileExtension) {
update((bodyEl) => {
bodyEl.createEl("p", {
text: `Could not determine file extension for downloaded file. Blob: ${blob.size} bytes.`,
});
});

throw new Error("Could not determine file extension");
}

if (!blob.type.contains("audio") || !fileExtension) {
if (!blob.type.contains("audio") && !fileExtension) {
update((bodyEl) => {
bodyEl.createEl("p", {
text: `Downloaded file is not an audio file. It is of type "${blob.type}". Blob: ${blob.size} bytes.`,
Expand Down

0 comments on commit 2c35e7a

Please sign in to comment.