Skip to content

Attachment API questions, possible tweaks #1623

@cheywood

Description

@cheywood

Hey all, great to see the recent merge of the attachments API 👍 🎉 @oli-ver @enjeck

I'm working to integrate it into a client and have a few questions with some possible user-centric suggestions. My knowledge about attachments in Nextcloud independent of this API is limited though, so I could be misunderstanding :)

Why is the random string used for API upload filenames, compared to web (OCA.Text) using the recognisable name?

Problems - A readable filename is a better experience for the user in non-WYSIWYG editors. Plus being able to know what the filename is probably going to be removes the need to, after every attachment upload completes, update the text in the note while it's being edited. The server also ends up with a bunch of more usefully named files.

Suggestion - Use the filename when it's unique. Upon name conflicts use the Nextcloud convention if there is one, or browser download conflict style suffixing (as users are familiar with this).

Why do the API uploads get stored alongside the note, compared to the web client's in a .attachments.<fileid> directory?

Problems - It lacks consistency with the web UI and arguably creates a bit of a mess. Plus if the discarding of filenames is resolved, having one namespace (per category) is more likely to result in filename conflicts.

Edit: also, attachments don't get deleted automatically with the note, unlike those in an .attachments.<fileid> directory.

A further edit: the attachments also don't get moved into the category sub-folders, resulting in disconnection from the note (again those with .attachments.<fileid> form do).

Suggestion - Do the same thing as the web editor.

How does one delete an attachment?

I'm guessing there's no garbage collection as that would mean parsing each markdown file to determine which files are no longer used? Access in the API would be useful.


If my suggestions make sense and nobody else is ready to jump on them I can have a look.

I'll hold on integrating changes into the client for now.

Comments are for MR #1600, original issue #826

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions