Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fail to detect the extension #23

Open
denismehmedvic opened this issue Mar 6, 2024 · 1 comment
Open

Fail to detect the extension #23

denismehmedvic opened this issue Mar 6, 2024 · 1 comment

Comments

@denismehmedvic
Copy link

denismehmedvic commented Mar 6, 2024

I stumbled across a situation in which the addon fails to detect the extension listed in warn list.

Namely, I received an email with the attachment file name in the following form "somefilename.pdf.xlsx". Per the settings, the file extension on which I should be getting warning covers XLSX, but not PDF. Here is a warn list from the settings: "DOC,DOCX,DOCM,PPT,PPTM,XLS,XLSM,XSLX,PPS,PPSM,HTML,HTM". The version I am running is 2.10.

I do not know how, but it looks like the code is missing to identify the extension due to the multiple dots in the file name formating. The code does look fine since it is addressing lastIndexOf.

let ext = attName.substring(attName.lastIndexOf(".")).toLowerCase();

Just an tought (altrough I do not work with JS), maybe using split instead of lastIndexOf or lastIndexOf(".")+1 could resolve the problem:


  // get the current file extension
  let attName = o.displayName ? o.displayName : o.name;
  var extArray = attName.split(".").toLowerCase();
  let ext = extArray.[extArray.length - 1];
@jdede
Copy link
Owner

jdede commented Mar 8, 2024

Just tested it as follows:

  • Created a mail with the attachment somefilename.pdf.xlsx
  • Try to open it: No problem
  • Added xlsx to the list of warning extensions: Get a warning when I try to open it
  • Remove xlsx from the list: No problem

The .pdf is not considered as it is not the last extension.

Right now, the version 2.10 seems to work as it should be. Which version of Thunderbird are you using?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants