Skip to content

Commit 240cd3e

Browse files
committed
fix: [OCISDEV-209] fix graph create link endpoint
1 parent d4280ca commit 240cd3e

File tree

5 files changed

+22
-14
lines changed

5 files changed

+22
-14
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Bugfix: Fix the create link endpoint
2+
3+
We fixed an issue when Shares drive can be shared via link share with Internal role using permissions endpoint
4+
5+
https://github.com/owncloud/ocis/pull/11542
6+
https://github.com/owncloud/ocis/issues/11409

services/graph/pkg/service/v0/api_driveitem_permissions_links.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,12 +153,18 @@ func (api DriveItemPermissionsApi) CreateLink(w http.ResponseWriter, r *http.Req
153153
logger := api.logger.SubloggerWithRequestID(r.Context())
154154
logger.Info().Msg("calling create link")
155155

156-
_, driveItemID, err := GetDriveAndItemIDParam(r, &logger)
156+
driveID, driveItemID, err := GetDriveAndItemIDParam(r, &logger)
157157
if err != nil {
158158
errorcode.RenderError(w, r, err)
159159
return
160160
}
161161

162+
if IsShareJail(driveID) && driveID.GetSpaceId() == driveItemID.GetOpaqueId() {
163+
api.logger.Debug().Interface("driveItemID", driveItemID).Msg("cannot create link on shares space root")
164+
errorcode.InvalidRequest.Render(w, r, http.StatusBadRequest, "cannot create link on shares space root")
165+
return
166+
}
167+
162168
var createLink libregraph.DriveItemCreateLink
163169
if err = StrictJSONUnmarshal(r.Body, &createLink); err != nil {
164170
logger.Error().Err(err).Interface("body", r.Body).Msg("could not create link: invalid body schema definition")

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -382,10 +382,6 @@ The expected failures in this file are from features in the owncloud/ocis repo.
382382

383383
- [apiSpacesShares/moveSpaces.feature:377](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesShares/moveSpaces.feature#L377)
384384

385-
#### [Shares drive can be shared via link share with Internal role using permissions endpoint](https://github.com/owncloud/ocis/issues/11409)
386-
387-
- [apiSharingNgDriveLinkShare/createInternalLinkShare.feature:339](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNgDriveLinkShare/createInternalLinkShare.feature#L339)
388-
389385
#### [Activities. no event for restoring file](https://github.com/owncloud/ocis/issues/10010)
390386

391387
- [apiActivities/activities.feature:3772](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiActivities/activities.feature#L3772)

tests/acceptance/features/apiSharingNgDriveLinkShare/createDriveLinkShare.feature

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -232,11 +232,11 @@ Feature: Link sharing of project spaces
232232
"""
233233
Examples:
234234
| permissions-role | drive | message |
235-
| View | Shares | no share permission |
236-
| Edit | Shares | no share permission |
237-
| Upload | Shares | no share permission |
238-
| File Drop | Shares | no share permission |
239-
| Secure View | Shares | invalid link type |
235+
| View | Shares | cannot create link on shares space root |
236+
| Edit | Shares | cannot create link on shares space root |
237+
| Upload | Shares | cannot create link on shares space root |
238+
| File Drop | Shares | cannot create link on shares space root |
239+
| Secure View | Shares | cannot create link on shares space root |
240240
| View | Personal | cannot create link on personal space root |
241241
| Edit | Personal | cannot create link on personal space root |
242242
| Upload | Personal | cannot create link on personal space root |

tests/acceptance/features/apiSharingNgDriveLinkShare/createInternalLinkShare.feature

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -360,16 +360,16 @@ Feature: Internal link share of project spaces
360360
"type": "object",
361361
"required": ["date","request-id"]
362362
},
363-
"message": {"const": "password is redundant for the internal link"}
363+
"message": {"const": "<message>"}
364364
}
365365
}
366366
}
367367
}
368368
"""
369369
Examples:
370-
| drive |
371-
| Personal |
372-
| Shares |
370+
| drive | message |
371+
| Personal | password is redundant for the internal link |
372+
| Shares | cannot create link on shares space root |
373373

374374

375375
Scenario: create an internal quick link share of a project-space using permissions endpoint

0 commit comments

Comments
 (0)