Skip to content

Commit b6b0d76

Browse files
author
David Christofas
committed
fix versions order in propfind response
1 parent 6494cac commit b6b0d76

File tree

5 files changed

+23
-15
lines changed

5 files changed

+23
-15
lines changed

changelog/unreleased/sort-versions.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Bugfix: Fix version order in propfind responses
2+
3+
The order of the file versions in propfind responses was incorrect.
4+
5+
https://github.com/cs3org/reva/pull/1911

internal/grpc/services/storageprovider/storageprovider.go

+18
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ package storageprovider
2020

2121
import (
2222
"context"
23+
"sort"
24+
2325
// "encoding/json"
2426
"fmt"
2527
"net/url"
@@ -763,6 +765,8 @@ func (s *service) ListFileVersions(ctx context.Context, req *provider.ListFileVe
763765
}, nil
764766
}
765767

768+
sort.Sort(descendingMtime(revs))
769+
766770
res := &provider.ListFileVersionsResponse{
767771
Status: status.NewOK(ctx),
768772
Versions: revs,
@@ -1193,3 +1197,17 @@ func (s *service) wrap(ctx context.Context, ri *provider.ResourceInfo) error {
11931197
ri.Path = path.Join(s.mountPath, ri.Path)
11941198
return nil
11951199
}
1200+
1201+
type descendingMtime []*provider.FileVersion
1202+
1203+
func (v descendingMtime) Len() int {
1204+
return len(v)
1205+
}
1206+
1207+
func (v descendingMtime) Less(i, j int) bool {
1208+
return v[i].Mtime >= v[j].Mtime
1209+
}
1210+
1211+
func (v descendingMtime) Swap(i, j int) {
1212+
v[i], v[j] = v[j], v[i]
1213+
}

tests/acceptance/expected-failures-on-OCIS-storage.md

-4
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,13 @@ Basic file management like up and download, move, copy, properties, quota, trash
2323
#### [Implement Versions Feature for ocis storage](https://github.com/owncloud/product/issues/210)
2424
- [apiWebdavEtagPropagation2/restoreVersion.feature:10](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavEtagPropagation2/restoreVersion.feature#L10)
2525

26-
#### [Version count is 1 more than on oC10](https://github.com/owncloud/ocis/issues/1633)
27-
- [apiVersions/fileVersionsSharingToShares.feature:178](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiVersions/fileVersionsSharingToShares.feature#L178)
28-
2926
#### [uploading with old-chunking does not work](https://github.com/owncloud/ocis/issues/1343)
3027
#### [remote.php/dav/uploads endpoint does not exist](https://github.com/owncloud/ocis/issues/1321)
3128
- [apiVersions/fileVersions.feature:15](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiVersions/fileVersions.feature#L15)
3229
- [apiVersions/fileVersions.feature:23](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiVersions/fileVersions.feature#L23)
3330
- [apiVersions/fileVersions.feature:36](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiVersions/fileVersions.feature#L36)
3431
- [apiVersions/fileVersions.feature:45](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiVersions/fileVersions.feature#L45)
3532
- [apiVersions/fileVersions.feature:88](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiVersions/fileVersions.feature#L88)
36-
- [apiVersions/fileVersions.feature:89](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiVersions/fileVersions.feature#L89)
3733
- [apiVersions/fileVersions.feature:93](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiVersions/fileVersions.feature#L93)
3834
- [apiVersions/fileVersions.feature:276](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiVersions/fileVersions.feature#L276)
3935
- [apiVersions/fileVersions.feature:347](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiVersions/fileVersions.feature#L347)

tests/acceptance/expected-failures-on-OWNCLOUD-storage.md

-4
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,6 @@ The following scenarios fail on OWNCLOUD storage but not on OCIS storage:
4242
- [apiTrashbinRestore/trashbinRestore.feature:330](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiTrashbinRestore/trashbinRestore.feature#L330)
4343
- [apiWebdavOperations/listFiles.feature:182](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavOperations/listFiles.feature#L182)
4444

45-
#### [Version count is 1 more than on oC10](https://github.com/owncloud/ocis/issues/1633)
46-
- [apiVersions/fileVersionsSharingToShares.feature:178](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiVersions/fileVersionsSharingToShares.feature#L178)
47-
4845
#### [downloading an old version of a file returns 501](https://github.com/owncloud/ocis/issues/2261)
4946
- [apiVersions/fileVersions.feature:420](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiVersions/fileVersions.feature#L420)
5047
- [apiVersions/fileVersions.feature:438](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiVersions/fileVersions.feature#L438)
@@ -57,7 +54,6 @@ The following scenarios fail on OWNCLOUD storage but not on OCIS storage:
5754
- [apiVersions/fileVersions.feature:36](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiVersions/fileVersions.feature#L36)
5855
- [apiVersions/fileVersions.feature:45](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiVersions/fileVersions.feature#L45)
5956
- [apiVersions/fileVersions.feature:88](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiVersions/fileVersions.feature#L88)
60-
- [apiVersions/fileVersions.feature:89](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiVersions/fileVersions.feature#L89)
6157
- [apiVersions/fileVersions.feature:93](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiVersions/fileVersions.feature#L93)
6258
- [apiVersions/fileVersions.feature:276](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiVersions/fileVersions.feature#L276)
6359
- [apiVersions/fileVersions.feature:347](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiVersions/fileVersions.feature#L347)

tests/acceptance/expected-failures-on-S3NG-storage.md

-7
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@ Basic file management like up and download, move, copy, properties, quota, trash
2020
- [apiTrashbinRestore/trashbinRestore.feature:309](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiTrashbin/trashbinRestore.feature#L309)
2121
- [apiTrashbinRestore/trashbinRestore.feature:310](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiTrashbin/trashbinRestore.feature#L310)
2222

23-
#### [Version count is 1 more than on oC10](https://github.com/owncloud/ocis/issues/1633)
24-
- [apiVersions/fileVersionsSharingToShares.feature:178](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiVersions/fileVersionsSharingToShares.feature#L178)
25-
2623
#### [downloading an old version of a file returns 501](https://github.com/owncloud/ocis/issues/2261)
2724
- [apiVersions/fileVersions.feature:420](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiVersions/fileVersions.feature#L420)
2825
- [apiVersions/fileVersions.feature:438](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiVersions/fileVersions.feature#L438)
@@ -38,7 +35,6 @@ Basic file management like up and download, move, copy, properties, quota, trash
3835
- [apiVersions/fileVersions.feature:36](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiVersions/fileVersions.feature#L36)
3936
- [apiVersions/fileVersions.feature:45](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiVersions/fileVersions.feature#L45)
4037
- [apiVersions/fileVersions.feature:88](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiVersions/fileVersions.feature#L88)
41-
- [apiVersions/fileVersions.feature:89](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiVersions/fileVersions.feature#L89)
4238
- [apiVersions/fileVersions.feature:93](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiVersions/fileVersions.feature#L93)
4339
- [apiVersions/fileVersions.feature:276](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiVersions/fileVersions.feature#L276)
4440
- [apiVersions/fileVersions.feature:347](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiVersions/fileVersions.feature#L347)
@@ -917,9 +913,6 @@ Scenario Outline: Renaming a file to a path with extension .part should not be p
917913
- [apiVersions/fileVersionsSharingToShares.feature:249](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiVersions/fileVersionsSharingToShares.feature#L249)
918914
- [apiVersions/fileVersionsSharingToShares.feature:250](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiVersions/fileVersionsSharingToShares.feature#L250)
919915

920-
#### [Version count is 1 more than on oC10](https://github.com/owncloud/ocis/issues/1633)
921-
- [apiVersions/fileVersionsSharingToShares.feature:178](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiVersions/fileVersionsSharingToShares.feature#L178)
922-
923916
####[not possible to move file into a received folder](https://github.com/owncloud/ocis/issues/764)
924917
- [apiVersions/fileVersionsSharingToShares.feature:221](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiVersions/fileVersionsSharingToShares.feature#L221)
925918
- [apiVersions/fileVersionsSharingToShares.feature:222](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiVersions/fileVersionsSharingToShares.feature#L222)

0 commit comments

Comments
 (0)