'File with .pptx extension is being downloaded without extension

Here is the function:

export const downloadFile = ({
  url,
  content,
  fileName,
  options
})=> {
  const anchor = document.createElement('a');
  const blobUrl = url || URL.createObjectURL(new Blob([content], options));

  anchor.setAttribute('href', blobUrl);
  anchor.setAttribute('download', fileName);
  anchor.click();
};

When I call it with options = { type: 'application/pdf' } it downloads the filename.pdf file, but when the type is application/vnd.openxmlformats-officedocument.presentationml.presentation, it downloads filename without extension, what's the problem?



Solution 1:[1]

So, the trouble is in OS, I don't have Power Point installed, that's why Windows is not recognizing the .pptx extension, I have tested the code on the laptop where Power Point is installed and everything works fine, same for MacOS (but it opens the file in Skype XD)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Alopwer