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

Multiple attachment files in a community post has all same name when saving #2743

Closed
slrslr opened this issue Apr 16, 2023 · 11 comments · Fixed by #2917
Closed

Multiple attachment files in a community post has all same name when saving #2743

slrslr opened this issue Apr 16, 2023 · 11 comments · Fixed by #2917
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@slrslr
Copy link

slrslr commented Apr 16, 2023

It appears that in a community when post has multiple image attachments, all have same name (when saving it), for example "session-attachment-2023-04-16-0123456.jpeg".
IMO the attachment name within one post would be handy to be unique so one does not need to rename each one:

Other information (please complete the following information):

  • Device: PC
  • OS: Linux AppImage
  • Session Version or Git commit hash: 1.10.8
@Bilb Bilb added bug Something isn't working good first issue Good for newcomers labels May 25, 2023
@RubenGarcia
Copy link

RubenGarcia commented Aug 26, 2023

Recommendation: call the attachments "session-attachment-2023-04-16-0123456-1.jpeg" .. "session-attachment-2023-04-16-0123456-<n>.jpeg"

@RubenGarcia
Copy link

types/Attachment.ts
getSuggestedFilename already has an index parameter for this, which is passed along from the calling function save.
but this parameter is not used in the calling function.
util/attachmentsUtil.ts
saveAttachmentToDisk.

saveAttachmentToDisk should have a new parameter index, which should be "" at
components/conversation/message/message-content/MessageAttachment.tsx
components/lightbox/LightboxGallery.tsx changes to:

    void saveAttachmentToDisk({ ...mediaItem, conversationId: selectedConversation,  
        index: props.selectedIndex });

components/conversation/message/message-content/MessageContextMenu.tsx
changes to:

        index: targetAttachmentIndex,

@RubenGarcia
Copy link

I'll try to get a patch for this.

@RubenGarcia
Copy link

Work in progress
RubenGarcia#1

@RubenGarcia
Copy link

If somebody else wants to tackle this, please do. This is my first patch here, so I will take a while to get used to the project.

@RubenGarcia
Copy link

@slrslr with this the first attachment keeps the name, but following attachments will have 001,002, ... added to them so the names are now unique.

@RubenGarcia
Copy link

I also have a branch which adds support to download all attachments in a message:
https://github.com/RubenGarcia/session-desktop/tree/DownloadAll
Would you be interested in that functionality?

@mrjackson6969
Copy link

Any new update regarding this change?

@RubenGarcia
Copy link

The patch needs to be approved by a developer, and I have not received any input yet.
Feel free to use the patch when you compile session.

@Bilb
Copy link
Collaborator

Bilb commented Oct 16, 2023

Hey, thanks for the PR!
I made some comments to that PR, let me know how it goes.

@RubenGarcia
Copy link

Also, have a look at #2928 when you have time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants