[bug] Attachment cleanup might remove a file that was already being used #1106
Labels
No labels
approved, awaiting change
broken setup
bug
cannot reproduce
configuration
documentation
duplicate
enhancement
extremely low priority
feature request
Fix it yourself
help wanted
invalid
mastodon_api
needs change/feedback
needs docs
needs tests
not a bug
not our bug
planned
pleroma_api
privacy
question
static_fe
triage
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
AkkomaGang/akkoma#1106
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Your setup
From source
Extra details
Alpine Linux
Version
Based of
0b061090acPostgreSQL version
18
What were you trying to do?
[Delete & Redraft] a post
What did you expect to happen?
Able to remade a post that has media attachment to it
What actually happened?
If attachment cleanup is enabled, These medias became unavailable
Logs
No response
Severity
No response
Have you searched for this issue?
The backend does not know of redrafts, it’s a FE feature as you already noticed in the FE version of this issue (one ticket about the same problem is sufficient; we can still move it if it was opened in the wrong repo)
There is however a grace period before media cleanup is attempted, to allow republication. This can be configured via
:instance, :cleanup_attachments_delay. If the 30min default is not sufficient, you can raise it.Dupe of #775
@Oneric wrote in #1106 (comment):
Strangely, even after such period of time, The attachment gets cleaned up anyway even after it's being posted before the grade period.
hmm, did you change something about your upload base URL or changed uploaders?
I’d need to check how the current cleanup logic works again, but this might possibly lead to it thinking nothing else is using the file (since no other upload has the same URL)
Or maybe do you have filename query args enabled s.t. the same upload can have matching domain and path but different query strings? Not sure if that’s relevant or taken into account atm, but i believe all who were testing it when the grace period was introduced do not enable filename hints.
@Oneric wrote in #1106 (comment):
I use S3 object storage and only that. The original logic is intact.
No. I have AnonymizedFilename enabled.
For a side note, I:
not sure whenever it can give you some idea
For reference,
AnonymizedFilenamesonly replaces the filename but doesn’t control whether the query omitted from URLs. The latter is controlled byPleroma.Upload, :link_name. Doesn’t seem like this is currently enabled on your instance either though (Whether or not this split makes sense is debatable, but it’s the config scheme we inherited.)Could you query a post from the db, both before and after the redraft, so we can take a look at how it’s actually encoded?
Instructions how to fetch posts from the db via the ID you see in URLs and the API can be found in the README here: https://akkoma.dev/Oneric/shinyrod
Additionally, since this is about uploads, can you also query the
objectstable for the stand-alone attachment? You’ll find the"id"of the attachent in the post object’sdataand can then query it withSELECT * FROM objects WHERE data->>'id' = 'the id property found within the posts attachment array';.Then wait and see whether the file and corresponding db objects actually remain preserved an hour later or both (r only one) got deleted.
Let me know if you need more detailed instructions
[bug] [Delete & Redraft] in Akkoma-FE won't retain media attachment when Attachment cleanup is enabled.to [bug] Attachment cleanup might remove a file that was already being usedsorry for the late response.
@Oneric wrote in #1106 (comment):
i will see whenever i can did it.
db object before and after
FRESH:
(1 row)
REDRAFTED (NO CLEANUP ENABLED):
(1 row)
2.5h passed since the redraft was posted and the attachement seems to be still around. So everything seems to be working now?
Ah, you wrote "no cleanup enabled". This won’t show the full picture. And you are missing the attachment object itself
@Oneric wrote in #1106 (comment):
as mentioned above, the cleanup is disabled, so i had no plan on reenabling this yet. but the other day i will, i guess.
I don't really see the attachment ID from the post's object alone:
do you get the attachment ID by the upload? or does the ID is the url?
Inside the database, local
attachmententries have anidproperty; in the entries you previously shared this id ishttps://fedinet.waltuh.cyou/objects/c0691d96-1cdd-429e-98ff-0f8c932293a3.When presenting the object to the outside world this id property is stripped out. Remote attachments generally do not have an
idproperty.