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

Fix: If two images are posted within the same second, only the first one will be saved. #2075

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

KhushamBansal
Copy link

@KhushamBansal KhushamBansal commented Jan 9, 2025

Checklist

  • Ensure your code works with manual testing.
  • New or updated public/exported symbols have accurate TSDoc documentation.
  • Linter and other CI checks pass.
  • I have licensed the changes to Element by completing the Contributor License Agreement (CLA)

My approach to solve the issue:

Added a timestamp to the filename:
Used Date.now() to get the current time in milliseconds.
Modified the targetFileName to include the timestamp, ensuring uniqueness.
Closes element-hq/element-web#29079

@KhushamBansal KhushamBansal requested a review from a team as a code owner January 9, 2025 21:25
@CLAassistant
Copy link

CLAassistant commented Jan 9, 2025

CLA assistant check
All committers have signed the CLA.

@github-actions github-actions bot added the Z-Community-PR Issue is solved by a community member's PR label Jan 9, 2025
@dosubot dosubot bot added the T-Defect label Jan 9, 2025
Copy link
Member

@MidhunSureshR MidhunSureshR left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what this is fixing, please provide some more context

@KhushamBansal
Copy link
Author

KhushamBansal commented Jan 10, 2025

Here is the issue I have work on: element-hq/element-web#29079
If two images are posted within the same second, only the first one will be saved.
My approach to solve the issue:
Added a timestamp to the filename:
Used Date.now() to get the current time in milliseconds.
Modified the targetFileName to include the timestamp, ensuring uniqueness.

@t3chguy
Copy link
Member

t3chguy commented Jan 13, 2025

The title is misleading, this change looks entirely unrelated to the export chat feature..

image

@KhushamBansal KhushamBansal changed the title Resolved: Some pictures are lost when exporting chat #1812 Fix: If two images are posted within the same second, only the first one will be saved Jan 17, 2025
@KhushamBansal KhushamBansal changed the title Fix: If two images are posted within the same second, only the first one will be saved Fix: If two images are posted within the same second, only the first one will be saved. Jan 17, 2025
@dbkr
Copy link
Member

dbkr commented Jan 23, 2025

Hello! You've updated the PR title but the description still links to the bug that this PR doesn't fix. I don't think there is a bug for the behaviour this PR is actually changing, and I'm not really sure how much of a problem it would be: most browsers will automatically append a '(1)' or similar if a file already exists by the same name. This would mean all downloaded files get a timestamp appended which doesn't seem desirable.

I think the best thing to do here might to apply a similar change to fix the original bug, which would be in the element-web repo, which I think would be https://github.com/element-hq/element-web/blob/a0044d6b5f841acd48870dcc99ff6f27f0248f61/src/utils/exportUtils/HtmlExport.tsx#L378 and corresponding places in the other exporters, ideally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-Defect Z-Community-PR Issue is solved by a community member's PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Some pictures are lost when exporting chat
5 participants