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: pasting multiple files #1987 #2306

Merged
merged 1 commit into from
Feb 20, 2024

Conversation

agiledev24
Copy link
Collaborator

No description provided.

Copy link
Collaborator

@leblowl leblowl left a comment

Choose a reason for hiding this comment

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

Looks like an improvement, thanks.

Do you think it also makes sense to remove this logic:

if (name === 'image') {
id = `${Date.now()}_${Math.random().toString(36).substring(0, 20)}`
} else {
id = name
}

and perhaps move some of this logic out of the component and into handleClipboardFiles:
const fileExt = path.extname(files[i].name).toLowerCase()
const fileName = path.basename(files[i].name, fileExt)
const arrayBuffer = await files[i].arrayBuffer()
handleClipboardFiles(arrayBuffer, fileExt, fileName)

It looks like perhaps we can also unify the two methods for uploading a file (copy/paste and file manager): https://github.com/agiledev24/quiet/blob/21aa76162ffc743f8d0b73646254548eb69d6c75/packages/common/src/fileData.ts#L4-L13

Just some ideas for the future if you're interested. Thankful for anything that makes the code easier to read.

@leblowl leblowl merged commit 7c6b669 into TryQuiet:develop Feb 20, 2024
17 of 21 checks passed
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

Successfully merging this pull request may close these issues.

None yet

2 participants