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

[HOLD for payment 2022-09-16] [$250] The file extension shows up twice in the file name reported by @Tushu17 #10579

Closed
kavimuru opened this issue Aug 25, 2022 · 25 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Daily KSv2 Engineering External Added to denote the issue can be worked on by a contributor

Comments

@kavimuru
Copy link

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Action Performed:

  1. Open website/mWeb.
  2. Go to chat > Send a jpeg/pdf attachment..
  3. See the name of attachment in preview.

Expected Result:

Extension shouldn't get repeated.

Actual Result:

It shows up twice.

Workaround:

Unknown

Platform:

Where is this issue occurring?

  • Web
  • Mobile Web

Version Number: 1.1.91-0
Reproducible in staging?: Y
Reproducible in production?: Y
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos:
2

Expensify/Expensify Issue URL:
Issue reported by: @Tushu17
Slack conversation:

View all open jobs on GitHub

@kavimuru kavimuru added the AutoAssignerTriage Auto assign issues for triage to an available triage team member label Aug 25, 2022
@melvin-bot
Copy link

melvin-bot bot commented Aug 25, 2022

Triggered auto assignment to @sonialiap (AutoAssignerTriage), see https://stackoverflow.com/c/expensify/questions/4749 for more details.

@melvin-bot melvin-bot bot added Daily KSv2 and removed AutoAssignerTriage Auto assign issues for triage to an available triage team member labels Aug 25, 2022
@theTrozen77
Copy link

Hi, I have been able to reproduce this and fix it successfully.
return {fileName: splitFileName[0], fileExtension};
The filename returned was not correct previously.
Thankyou

@Puneet-here
Copy link
Contributor

Proposal

There are two extensions because we aren't removing the extension from file name and we are adding the extension here too

trailingText={fileExtension ? `.${fileExtension}` : ''}

The above proposal doesn't work great when a file name has periods in it. It will take the text before the period so the file name will be incomplete.
We can use slice(0, -1).join('.') after split. This way we will get the whole file name without extension then we just have to use that instead of the one with the extension.

@melvin-bot
Copy link

melvin-bot bot commented Aug 29, 2022

@sonialiap Whoops! This issue is 2 days overdue. Let's get this updated quick!

@melvin-bot melvin-bot bot added the Overdue label Aug 29, 2022
@sonialiap
Copy link
Contributor

Triaging, can confirm described behavior
image

@melvin-bot melvin-bot bot removed the Overdue label Aug 29, 2022
@sonialiap sonialiap removed their assignment Aug 29, 2022
@melvin-bot
Copy link

melvin-bot bot commented Aug 29, 2022

Triggered auto assignment to @johnmlee101 (Engineering), see https://stackoverflow.com/c/expensify/questions/4319 for more details.

@johnmlee101
Copy link
Contributor

Opening for external, seems like a very easy fix based off of the two proposals already

@johnmlee101 johnmlee101 added the External Added to denote the issue can be worked on by a contributor label Aug 30, 2022
@johnmlee101 johnmlee101 removed their assignment Aug 30, 2022
@melvin-bot
Copy link

melvin-bot bot commented Aug 30, 2022

Triggered auto assignment to @arielgreen (External), see https://stackoverflow.com/c/expensify/questions/8582 for more details.

@theTrozen77
Copy link

Proposal

There are two extensions because we aren't removing the extension from file name and we are adding the extension here too

trailingText={fileExtension ? `.${fileExtension}` : ''}

The above proposal doesn't work great when a file name has periods in it. It will take the text before the period so the file name will be incomplete. We can use slice(0, -1).join('.') after split. This way we will get the whole file name without extension then we just have to use that instead of the one with the extension.

I believe when Puneet is suggesting here might be an extension to this issue and could be a new ticket. However, my proposal above completely fixes the actual issue here which is that the extension are being repeated twice.

@Puneet-here
Copy link
Contributor

It's not an extension, your proposal fixes the issue but breaks the file name when there are periods in it, if a solution breaks something then it's not a good solution

@sobitneupane
Copy link
Contributor

Proposal
Reason:
splitExtensionFromFileName() function returns fileName as it is without removing the extension.

splitExtensionFromFileName(fullFileName) {
const fileName = fullFileName.trim();
const splitFileName = fileName.split('.');
const fileExtension = splitFileName.pop();
return {fileName, fileExtension};
}

Solution:
As fileExtension is already popped from splitFileName, we can join splitFileName with '.' to get fileName without extension.

    splitExtensionFromFileName(fullFileName) {
        const fileName = fullFileName.trim();
        const splitFileName = fileName.split('.');
        const fileExtension = splitFileName.pop();
-      return {fileName, fileExtension};
+        return {fileName: splitFileName.join('.'), fileExtension};
    }

Output:
Screen Shot 2022-08-31 at 17 02 24

@varshamb
Copy link
Contributor

Proposal

In AttachementModal, splitExtensionFromFileName() returns file name with extension.

We should return this instead -
const fileNameWithoutExtension = fileName.substring(0, fileName.lastIndexOf('.')) || fileName;

I think this code more readable.

splitExtensionFromFileName(fullFileName) {
const fileName = fullFileName.trim();
const splitFileName = fileName.split('.');
const fileExtension = splitFileName.pop();
return {fileName, fileExtension};
}

@arielgreen
Copy link
Contributor

@melvin-bot melvin-bot bot added Weekly KSv2 and removed Daily KSv2 labels Aug 31, 2022
@melvin-bot
Copy link

melvin-bot bot commented Aug 31, 2022

Triggered auto assignment to Contributor-plus team member for initial proposal review - @parasharrajat (Exported)

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Aug 31, 2022
@melvin-bot
Copy link

melvin-bot bot commented Aug 31, 2022

Triggered auto assignment to @Luke9389 (Exported), see https://stackoverflow.com/c/expensify/questions/7972 for more details.

@melvin-bot melvin-bot bot changed the title The file extension shows up twice in the file name reported by @Tushu17 [$250] The file extension shows up twice in the file name reported by @Tushu17 Aug 31, 2022
@parasharrajat
Copy link
Member

Regression caused by #10118.

@sobitneupane 's proposal looks good to me.

cc: @Luke9389

🎀 👀 🎀 C+ reviewed

@Luke9389
Copy link
Contributor

Luke9389 commented Sep 6, 2022

I agree that we should go with @sobitneupane's proposal. Go ahead and create a PR @sobitneupane.
Thank you @sobitneupane, @Puneet-here, @varshamb, @theTrozen77 for your proposals!

@Puneet-here your proposal would work, but I like that @sobitneupane's fixes the problem at the source (the splitExtensionFromFileName function).

@theTrozen77 & @Puneet-here, please try to refrain from openly criticizing each others' proposals. If a proposal is chosen and you disagree with the result, that's the time to talk about the flaws you see.

@Puneet-here
Copy link
Contributor

please try to refrain from openly criticizing each others' proposals. If a proposal is chosen and you disagree with the result, that's the time to talk about the flaws you see.

Cool, will remember next time.

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Sep 9, 2022
@melvin-bot melvin-bot bot changed the title [$250] The file extension shows up twice in the file name reported by @Tushu17 [HOLD for payment 2022-09-16] [$250] The file extension shows up twice in the file name reported by @Tushu17 Sep 9, 2022
@melvin-bot
Copy link

melvin-bot bot commented Sep 9, 2022

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.1.98-1 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2022-09-16. 🎊

@mallenexpensify mallenexpensify removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Sep 14, 2022
@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Sep 15, 2022
@arielgreen
Copy link
Contributor

@sobitneupane @Tushu17 @parasharrajat Please check your Upwork inboxes!

@melvin-bot melvin-bot bot added the Overdue label Sep 19, 2022
@Luke9389
Copy link
Contributor

just waiting on payment to close this out melvin.

@melvin-bot melvin-bot bot removed the Overdue label Sep 19, 2022
@Luke9389 Luke9389 added the Reviewing Has a PR in review label Sep 19, 2022
@melvin-bot
Copy link

melvin-bot bot commented Sep 27, 2022

@parasharrajat, @arielgreen, @Luke9389 Whoops! This issue is 2 days overdue. Let's get this updated quick!

@parasharrajat
Copy link
Member

parasharrajat commented Sep 27, 2022

Bump @arielgreen, this is awaiting payment for a long time. Can we please remove the Reviewing label so that CM gets daily notifications?

@Luke9389 Luke9389 removed the Reviewing Has a PR in review label Sep 27, 2022
@arielgreen
Copy link
Contributor

thanks @parasharrajat resent

@arielgreen
Copy link
Contributor

Paid.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Daily KSv2 Engineering External Added to denote the issue can be worked on by a contributor
Projects
None yet
Development

No branches or pull requests