Skip to content

Commit

Permalink
core: allow deleting unuploaded attachments
Browse files Browse the repository at this point in the history
  • Loading branch information
thecodrr committed Nov 25, 2023
1 parent 1c888bd commit ead0e01
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/core/src/collections/attachments.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,12 @@ export default class Attachments extends Collection {
if (!localOnly && !(await this._canDetach(attachment)))
throw new Error("This attachment is inside a locked note.");

if (await this._db.fs.deleteFile(attachment.metadata.hash, localOnly)) {
if (
await this._db.fs.deleteFile(
attachment.metadata.hash,
localOnly || !attachment.dateUploaded
)
) {
if (!localOnly) {
await this.detach(attachment);
}
Expand Down

0 comments on commit ead0e01

Please sign in to comment.