Skip to content

[Proposal] Attachments storage improvement in database #29693

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

Open
lunny opened this issue Mar 9, 2024 · 0 comments
Open

[Proposal] Attachments storage improvement in database #29693

lunny opened this issue Mar 9, 2024 · 0 comments
Labels
type/proposal The new feature has not been accepted yet but needs to be discussed first.

Comments

@lunny
Copy link
Member

lunny commented Mar 9, 2024

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.

@lunny lunny added the type/proposal The new feature has not been accepted yet but needs to be discussed first. label Mar 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/proposal The new feature has not been accepted yet but needs to be discussed first.
Projects
None yet
Development

No branches or pull requests

1 participant