From 48683cf7daa7e29c7602ac40934f3d06d8f35122 Mon Sep 17 00:00:00 2001 From: Jesse Geens Date: Mon, 13 Jan 2025 09:01:39 +0100 Subject: [PATCH] Resolving more comments on PR --- share/model.go | 2 -- share/sql/sql.go | 16 +++++++++++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/share/model.go b/share/model.go index ac65af2..7807a0d 100644 --- a/share/model.go +++ b/share/model.go @@ -38,8 +38,6 @@ type ProtoShare struct { ItemType ItemType // file | folder | reference | symlink InitialPath string Inode string - FileSource int64 - FileTarget string Permissions uint8 Instance string Orphan bool diff --git a/share/sql/sql.go b/share/sql/sql.go index 71b227d..fd588f5 100644 --- a/share/sql/sql.go +++ b/share/sql/sql.go @@ -264,7 +264,21 @@ func (m *mgr) GetShare(ctx context.Context, ref *collaboration.ShareReference) ( } func (m *mgr) Unshare(ctx context.Context, ref *collaboration.ShareReference) error { - share, err := m.getShare(ctx, ref) + var share *model.Share + var err error + if id := ref.GetId(); id != nil { + var intId int + intId, err = strconv.Atoi(id.OpaqueId) + share = &model.Share{ + ProtoShare: model.ProtoShare{ + Model: gorm.Model{ + ID: uint(intId), + }, + }, + } + } else { + share, err = m.getShare(ctx, ref) + } if err != nil { return err }