Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Home folder in share paths #4926

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions changelog/unreleased/bugfix-home-folder-in-shares
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Bugfix: homeFolder in share paths

We had a bug in building resources from shares as we didn't prefix the share paths with the homeFolder path.

https://github.com/owncloud/web/issues/4823
https://github.com/owncloud/web/pulls/4926
21 changes: 16 additions & 5 deletions packages/web-app-files/src/helpers/resources.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,21 +103,30 @@ export function attachIndicators(resource, sharesTree) {
* @param {Boolean} allowSharePerm Asserts whether the reshare permission is available
* @param {String} server The url of the backend
* @param {String} token The access token of the authenticated user
* @param {String} homeFolder The homeFolder path of the authenticated user
*/
export async function aggregateResourceShares(
shares,
incomingShares = false,
allowSharePerm,
server,
token
token,
homeFolder
) {
if (incomingShares) {
return Promise.all(
_(shares)
.orderBy(['file_target', 'permissions'], ['asc', 'desc'])
.map(
async share =>
await buildSharedResource(share, incomingShares, allowSharePerm, server, token)
await buildSharedResource(
share,
incomingShares,
allowSharePerm,
server,
token,
homeFolder
)
)
)
}
Expand Down Expand Up @@ -167,7 +176,8 @@ export async function aggregateResourceShares(

return Promise.all(
resources.map(
async share => await buildSharedResource(share, incomingShares, allowSharePerm, server, token)
async share =>
await buildSharedResource(share, incomingShares, allowSharePerm, server, token, homeFolder)
)
)
}
Expand All @@ -177,7 +187,8 @@ export async function buildSharedResource(
incomingShares = false,
allowSharePerm,
server,
token
token,
homeFolder
) {
const resource = {
id: share.item_source,
Expand Down Expand Up @@ -207,9 +218,9 @@ export async function buildSharedResource(
resource.shareOwnerDisplayname = share.displayname_owner
resource.name = path.basename(share.path)
resource.path = share.path
// permissions irrelevant here
resource.isReceivedShare = () => false
}
resource.path = path.join(homeFolder, resource.path)
resource.extension = isFolder ? '' : _getFileExtension(resource.name)
// FIXME: add actual permission parsing
resource.canUpload = () => true
Expand Down
5 changes: 3 additions & 2 deletions packages/web-app-files/src/views/SharedViaLink.vue
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export default {
'inProgress',
'activeFilesCount'
]),
...mapGetters(['isOcis', 'configuration', 'getToken', 'user']),
...mapGetters(['isOcis', 'configuration', 'getToken', 'user', 'homeFolder']),

selected: {
get() {
Expand Down Expand Up @@ -156,7 +156,8 @@ export default {
false,
!this.isOcis,
this.configuration.server,
this.getToken
this.getToken,
this.homeFolder
)

this.LOAD_FILES({ currentFolder: rootFolder, files: resources })
Expand Down
8 changes: 5 additions & 3 deletions packages/web-app-files/src/views/SharedWithMe.vue
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export default {
'inProgress',
'activeFilesCount'
]),
...mapGetters(['isOcis', 'configuration', 'getToken', 'user']),
...mapGetters(['isOcis', 'configuration', 'getToken', 'user', 'homeFolder']),

selected: {
get() {
Expand Down Expand Up @@ -190,7 +190,8 @@ export default {
true,
!this.isOcis,
this.configuration.server,
this.getToken
this.getToken,
this.homeFolder
)

this.LOAD_FILES({ currentFolder: rootFolder, files: resources })
Expand Down Expand Up @@ -238,7 +239,8 @@ export default {
true,
!this.isOcis,
this.configuration.server,
this.getToken
this.getToken,
this.homeFolder
)
this.UPDATE_RESOURCE(sharedResource)
}
Expand Down
5 changes: 3 additions & 2 deletions packages/web-app-files/src/views/SharedWithOthers.vue
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export default {
'inProgress',
'activeFilesCount'
]),
...mapGetters(['isOcis', 'configuration', 'getToken', 'user']),
...mapGetters(['isOcis', 'configuration', 'getToken', 'user', 'homeFolder']),

selected: {
get() {
Expand Down Expand Up @@ -158,7 +158,8 @@ export default {
false,
!this.isOcis,
this.configuration.server,
this.getToken
this.getToken,
this.homeFolder
)

this.LOAD_FILES({ currentFolder: rootFolder, files: resources })
Expand Down