Skip to content

Commit 4a85e52

Browse files
committed
Fix bug where token, share_name, notify_uploads and expiration are missing
1 parent a2a5dd1 commit 4a85e52

File tree

2 files changed

+4
-12
lines changed

2 files changed

+4
-12
lines changed

share/sql/migrate.go

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ type OldShareEntry struct {
4949
Quicklink bool
5050
Description string
5151
NotifyUploads bool
52-
NotifyUploadsExtraRecipients sql.NullString
52+
NotifyUploadsExtraRecipients string
5353
Orphan bool
5454
}
5555

@@ -123,7 +123,7 @@ func migrateShares(ctx context.Context, migrator Migrator) {
123123
fmt.Printf("Migrating %d shares\n", count)
124124

125125
// Get all old shares
126-
query := "select id, coalesce(uid_owner, '') as uid_owner, coalesce(uid_initiator, '') as uid_initiator, lower(coalesce(share_with, '')) as share_with, coalesce(fileid_prefix, '') as fileid_prefix, coalesce(item_source, '') as item_source, coalesce(item_type, '') as item_type, stime, permissions, share_type, orphan FROM oc_share order by id desc" // AND id=?"
126+
query := "select id, coalesce(uid_owner, '') as uid_owner, coalesce(uid_initiator, '') as uid_initiator, lower(coalesce(share_with, '')) as share_with, coalesce(fileid_prefix, '') as fileid_prefix, coalesce(item_source, '') as item_source, coalesce(item_type, '') as item_type, coalesce(token, '') as token, expiration, stime, permissions, share_type, coalesce(share_name, '') as share_name, notify_uploads, coalesce(notify_uploads_extra_recipients, '') as notify_uploads_extra_recipients, orphan FROM oc_share order by id desc" // AND id=?"
127127
params := []interface{}{}
128128

129129
res, err := migrator.OldDb.Query(query, params...)
@@ -144,7 +144,7 @@ func migrateShares(ctx context.Context, migrator Migrator) {
144144

145145
for res.Next() {
146146
var s OldShareEntry
147-
res.Scan(&s.ID, &s.UIDOwner, &s.UIDInitiator, &s.ShareWith, &s.Prefix, &s.ItemSource, &s.ItemType, &s.STime, &s.Permissions, &s.ShareType, &s.Orphan)
147+
res.Scan(&s.ID, &s.UIDOwner, &s.UIDInitiator, &s.ShareWith, &s.Prefix, &s.ItemSource, &s.ItemType, &s.Token, &s.Expiration, &s.STime, &s.Permissions, &s.ShareType, &s.ShareName, &s.NotifyUploads, &s.NotifyUploadsExtraRecipients, &s.Orphan)
148148
if err == nil {
149149
ch <- &s
150150
} else {
@@ -302,18 +302,14 @@ func oldShareToNewShare(ctx context.Context, migrator Migrator, s *OldShareEntry
302302
},
303303
}, nil
304304
} else if s.ShareType == 3 {
305-
notifyUploadsExtraRecipients := ""
306-
if s.NotifyUploadsExtraRecipients.Valid {
307-
notifyUploadsExtraRecipients = s.NotifyUploadsExtraRecipients.String
308-
}
309305
return &ShareOrLink{
310306
IsShare: false,
311307
Link: &model.PublicLink{
312308
ProtoShare: protoShare,
313309
Token: s.Token,
314310
Quicklink: s.Quicklink,
315311
NotifyUploads: s.NotifyUploads,
316-
NotifyUploadsExtraRecipients: notifyUploadsExtraRecipients,
312+
NotifyUploadsExtraRecipients: s.NotifyUploadsExtraRecipients,
317313
Password: s.ShareWith,
318314
LinkName: s.ShareName,
319315
},

share/sql/sql.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,6 @@ func New(ctx context.Context, m map[string]interface{}) (revashare.Manager, erro
130130
}, nil
131131
}
132132

133-
func (m *mgr) getDb() *gorm.DB {
134-
return m.db
135-
}
136-
137133
func (m *mgr) Share(ctx context.Context, md *provider.ResourceInfo, g *collaboration.ShareGrant) (*collaboration.Share, error) {
138134
user := appctx.ContextMustGetUser(ctx)
139135

0 commit comments

Comments
 (0)