Skip to content

fix: Dropping a file from another browser window creates two upload dialogs - #31332

Merged
kodiakhq[bot] merged 3 commits into
RocketChat:developfrom
Sayan4444:duplicateFileUploads
Jan 8, 2024
Merged

fix: Dropping a file from another browser window creates two upload dialogs#31332
kodiakhq[bot] merged 3 commits into
RocketChat:developfrom
Sayan4444:duplicateFileUploads

Conversation

@Sayan4444

@Sayan4444 Sayan4444 commented Dec 28, 2023

Copy link
Copy Markdown
Contributor

Proposed changes (including videos or screenshots)
BEFORE THE FIX
https://github.com/RocketChat/Rocket.Chat/assets/112304873/a6f0faf1-cd9a-480d-bbe1-c60044d10205

AFTER THE FIX
https://github.com/RocketChat/Rocket.Chat/assets/112304873/d59fb5c2-9fcd-40fc-9630-8386a0712520

REASON BEHIND CHANGES
We are comparing the files by their size in bytes and checking for any duplicate files as it is very hard to find files of same size.We can also use nodejs to check but it takes a bit longer for long files.If you want the nodejs version please do tell me.

Issue(s)
This should close issues :-
closes #30793

Steps to test or reproduce
Open a Rocket.Chat channel in one Chromium window.
Open the image to be drag-and-dropped in another Chromium window.
Drag the image and drop it into the Rocket.Chat channel.

@Sayan4444
Sayan4444 requested a review from a team as a code owner December 28, 2023 06:33
@changeset-bot

changeset-bot Bot commented Dec 28, 2023

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 0cb0583

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 30 packages
Name Type
@rocket.chat/meteor Patch
@rocket.chat/core-typings Patch
@rocket.chat/rest-typings Patch
@rocket.chat/core-services Patch
@rocket.chat/cron Patch
@rocket.chat/gazzodown Patch
@rocket.chat/livechat Patch
@rocket.chat/model-typings Patch
@rocket.chat/ui-contexts Patch
@rocket.chat/account-service Patch
@rocket.chat/authorization-service Patch
@rocket.chat/ddp-streamer Patch
@rocket.chat/omnichannel-transcript Patch
@rocket.chat/presence-service Patch
@rocket.chat/queue-worker Patch
@rocket.chat/stream-hub-service Patch
@rocket.chat/api-client Patch
@rocket.chat/license Patch
@rocket.chat/omnichannel-services Patch
@rocket.chat/pdf-worker Patch
@rocket.chat/presence Patch
rocketchat-services Patch
@rocket.chat/ddp-client Patch
@rocket.chat/fuselage-ui-kit Patch
@rocket.chat/models Patch
@rocket.chat/ui-client Patch
@rocket.chat/ui-video-conf Patch
@rocket.chat/uikit-playground Patch
@rocket.chat/web-ui-registration Patch
@rocket.chat/instance-status Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@Sayan4444 Sayan4444 changed the title fix:Dropping a file from another browser window creates two upload dialogs fix: Dropping a file from another browser window creates two upload dialogs Dec 28, 2023
@codecov

codecov Bot commented Dec 28, 2023

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (d6165ad) 48.94% compared to head (0cb0583) 45.31%.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #31332      +/-   ##
===========================================
- Coverage    48.94%   45.31%   -3.64%     
===========================================
  Files         3289     3204      -85     
  Lines        81002    75232    -5770     
  Branches     16597    15283    -1314     
===========================================
- Hits         39647    34091    -5556     
- Misses       36693    36730      +37     
+ Partials      4662     4411     -251     
Flag Coverage Δ
e2e 52.94% <100.00%> (+1.60%) ⬆️
e2e-api 40.70% <ø> (+0.04%) ⬆️
unit ?

Flags with carried forward coverage won't be shown. Click here to find out more.

@hugocostadev

Copy link
Copy Markdown
Contributor

Did you understand why it's creating two files? I think that we need to fix this problem instead of resolving this issue in our application

@Sayan4444

Copy link
Copy Markdown
Contributor Author

Yes I have @hugocostadev.
image
The primary cause of multiple files being created for (some type of files) is this commented-out code(commented by me for now for demonstration purpose). The program attempts to send a get request to each src of img contained in the dropped file as soon as the if condition is satisfied. A duplicate file is not produced if the URL returns an error stating that a direct request is blocked.
Example

Screenshot 2024-01-04 235343

However, if the request is made, a new file containing the identical picture is created and added to the files array that previously included the image, resulting in the creation of a duplicate file.

The problematic code has been commented out, and practically all cases for drag and drop runs normally. Would you kindly let me know if I missed any cases and how do you want me to approach the situation with the duplicate files?

@hugocostadev

Copy link
Copy Markdown
Contributor

@Sayan4444 I could not reproduce this issue in any browser... maybe it's a OS and/or browser issue, I'll try to reproduce on windows and some other browsers

I'm using MacOS

@Sayan4444

Copy link
Copy Markdown
Contributor Author

@hugocostadev can you check from this website,
https://tenor.com/
and revert me back?

@hugocostadev

Copy link
Copy Markdown
Contributor

For me does not work but a windows user tested and it was able to reproduce, I'll accept your solution! Thanks

hugocostadev
hugocostadev previously approved these changes Jan 5, 2024
@dionisio-bot dionisio-bot Bot added stat: ready to merge PR tested and approved waiting for merge and removed stat: needs QA labels Jan 5, 2024
@hugocostadev hugocostadev added this to the 6.6 milestone Jan 8, 2024
@dionisio-bot dionisio-bot Bot added stat: ready to merge PR tested and approved waiting for merge and removed stat: ready to merge PR tested and approved waiting for merge labels Jan 8, 2024
@kodiakhq
kodiakhq Bot merged commit 7a187dc into RocketChat:develop Jan 8, 2024
@Sayan4444
Sayan4444 deleted the duplicateFileUploads branch January 8, 2024 16:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community stat: ready to merge PR tested and approved waiting for merge

Projects

Development

Successfully merging this pull request may close these issues.

Dropping a file from another browser window creates two upload dialogs

3 participants