Skip to content

[Proposal] Attachments storage improvement in database #29693

Open
@lunny

Description

@lunny

Feature Description

Purpose

Upon addressing a bug preventing team members from accessing pasted images, I have initiated PR #29492 to rectify the issue. However, upon investigation, it has become apparent that the issue runs deeper than anticipated. This proposal aims to streamline the logic governing all attachments and comprehensively resolve the issue.

Current implementation of Attachments

As per the current implementation, attachments are categorized into four types based on their associated features: release attachments, issue attachments, comment attachments, and temporary attachments.

  • Release attachments are identified by having release_id > 0.
  • Issue attachments are those with issue_id > 0 and comment_id == 0.
  • Comment attachments have issue_id > 0 and comment_id > 0.
  • Temporary attachments are characterized by having all of release_id, issue_id, and comment_id == 0.

Attachments are uploaded via two methods: dragging or click-selecting, and pasting images. Initially, all newly uploaded attachments are considered temporary. Upon submission, dragged or click-selected attachments are updated with issue_id/comment_id/release_id as appropriate. However, pasted image attachments remain unchanged and are perpetually treated as temporary attachments. Consequently, assigning permissions to these attachments becomes challenging.

Proposed Resolution

To address this issue, I propose the addition of a new column to the attachment table to denote the attachment's upload method (i.e., pasted or dragged). Simultaneously, pasted images should be distinguished from temporary attachments by including issue_id/comment_id/release_id information. (While pasted images are not currently supported for releases, this feature may be implemented in the future.)

Additionally, we need to parse the markdown content on issues/comments/releases to extract attachment links and retrieve the corresponding attachment UUIDs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/proposalThe new feature has not been accepted yet but needs to be discussed first.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions