@@ -1295,51 +1295,51 @@ func (fs *owncloudsqlfs) trashVersions(ctx context.Context, ip string, origin st
12951295 return nil
12961296}
12971297
1298- func (fs * owncloudsqlfs ) Move (ctx context.Context , oldRef , newRef * provider.Reference ) (err error ) {
1299- var oldIP string
1300- if oldIP , err = fs . resolve ( ctx , oldRef ); err != nil {
1301- return errors .Wrap (err , "owncloudsql: error resolving reference" )
1298+ func (fs * owncloudsqlfs ) Move (ctx context.Context , oldRef , newRef * provider.Reference ) (* storage. MoveResult , error ) {
1299+ oldIP , err := fs . resolve ( ctx , oldRef )
1300+ if err != nil {
1301+ return nil , errors .Wrap (err , "owncloudsql: error resolving reference" )
13021302 }
13031303
13041304 // check permissions
13051305 if perm , err := fs .readPermissions (ctx , oldIP ); err == nil {
13061306 if ! perm .Move { // TODO add dedicated permission?
1307- return errtypes .PermissionDenied ("" )
1307+ return nil , errtypes .PermissionDenied ("" )
13081308 }
13091309 } else {
13101310 if isNotFound (err ) {
1311- return errtypes .NotFound (fs .toStoragePath (ctx , filepath .Dir (oldIP )))
1311+ return nil , errtypes .NotFound (fs .toStoragePath (ctx , filepath .Dir (oldIP )))
13121312 }
1313- return errors .Wrap (err , "owncloudsql: error reading permissions" )
1313+ return nil , errors .Wrap (err , "owncloudsql: error reading permissions" )
13141314 }
13151315
1316- var newIP string
1317- if newIP , err = fs . resolve ( ctx , newRef ); err != nil {
1318- return errors .Wrap (err , "owncloudsql: error resolving reference" )
1316+ newIP , err := fs . resolve ( ctx , newRef )
1317+ if err != nil {
1318+ return nil , errors .Wrap (err , "owncloudsql: error resolving reference" )
13191319 }
13201320
13211321 // TODO check target permissions ... if it exists
1322- storage , err := fs .getStorage (ctx , oldIP )
1322+ stor , err := fs .getStorage (ctx , oldIP )
13231323 if err != nil {
1324- return err
1324+ return nil , err
13251325 }
1326- err = fs .filecache .Move (ctx , storage , fs .toDatabasePath (oldIP ), fs .toDatabasePath (newIP ))
1326+ err = fs .filecache .Move (ctx , stor , fs .toDatabasePath (oldIP ), fs .toDatabasePath (newIP ))
13271327 if err != nil {
1328- return err
1328+ return nil , err
13291329 }
13301330 if err = os .Rename (oldIP , newIP ); err != nil {
1331- return errors .Wrap (err , "owncloudsql: error moving " + oldIP + " to " + newIP )
1331+ return nil , errors .Wrap (err , "owncloudsql: error moving " + oldIP + " to " + newIP )
13321332 }
13331333
13341334 if err := fs .propagate (ctx , newIP ); err != nil {
1335- return err
1335+ return nil , err
13361336 }
13371337 if filepath .Dir (newIP ) != filepath .Dir (oldIP ) {
13381338 if err := fs .propagate (ctx , filepath .Dir (oldIP )); err != nil {
1339- return err
1339+ return nil , err
13401340 }
13411341 }
1342- return nil
1342+ return nil , nil
13431343}
13441344
13451345func (fs * owncloudsqlfs ) GetMD (ctx context.Context , ref * provider.Reference , mdKeys []string , fieldMask []string ) (* provider.ResourceInfo , error ) {
0 commit comments