-
Notifications
You must be signed in to change notification settings - Fork 191
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
Cannot paste more than one image into a new posting. #2345
Comments
this happens because we filter attachments by name. Because a pasted image as no name, it gets filtered out. Should be easy to allow duplicate empty filename (check |
Actually, it would appear that a pasted image is given the internal name
Thanks for this pointer. I can see how to fix the problem now. The easiest way is obviously not to check for duplicate names at all. That seemed lazy, though, so I instead chose to keep the check for duplicate names, but to ignore any named That worked, but revealed the full extent of this bug, which is that the deduping function really only considers the file's name, not its content. This means that:
So, we're actually getting both false positives and false negatives here, which seems as if it's doing more harm than good and inclines me to go back to my original solution of skipping the deduping altogether. |
@Bilb Do you have any idea where the name I just cannot find the place in the code where this assignment takes place. Obviously it's not a trivial string assignment or I would have located it immediately. |
Previously, the code simply deduped attachments on file name, using the internal name `image.png` for any pasted image. This effectively made it possible to paste only a single image into a message. Now, we ignore files called `image.png` when deduping. Deduping on file name is flawed anyway, because: 1. It's trivial to post multiple identical attachments, so long as each of them has a different file name. 2. It's **not** possible to post different attachments if they happen to have the same base file name (i.e. after the directory component is removed). So, we're actually getting both false positives and false negatives here. Fixes oxen-io#2345, but introduces a new problem: When deleting a pasted attachment from a list of such attachments prior to sending, **all** pasted attachments are removed, presumably due to their all having the same internal file name. It may be better not to dedupe attachments at all, rather than use the crude mechanism of the file name. In that case, the following code would suffice: ``` - const uniqAttachments = _.uniqBy(allAttachments, m => m.fileName); - state.stagedAttachments[conversationKey] = uniqAttachments; + state.stagedAttachments[conversationKey] = allAttachments; ```
Previously, the code simply deduped attachments on file name, using the internal name `image.png` for any pasted image. This effectively made it possible to paste only a single image into a message. Now, we ignore files called `image.png` when deduping. Deduping on file name is flawed anyway, because: 1. It's trivial to post multiple identical attachments, so long as each of them has a different file name. 2. It's **not** possible to post different attachments if they happen to have the same base file name (i.e. after the directory component is removed). So, we're actually getting both false positives and false negatives here. Fixes oxen-io#2345, but introduces a new problem: When deleting a pasted attachment from a list of such attachments prior to sending, **all** pasted attachments are removed, presumably due to their all having the same internal file name. It may be better not to dedupe attachments at all, rather than use the crude mechanism of the file name. In that case, the following code would suffice: ``` - const uniqAttachments = _.uniqBy(allAttachments, m => m.fileName); - state.stagedAttachments[conversationKey] = uniqAttachments; + state.stagedAttachments[conversationKey] = allAttachments; ```
Describe the bug
The composition window allows a single image to be pasted directly into it, but not multiple images. The first image may be pasted or selected from a file, but subsequent images can only selected from files.
When making N screenshots to attach to a posting, it's a hindrance to have to save N-1 of them to files, and then select them for attachment.
To Reproduce
The text was updated successfully, but these errors were encountered: