graph: Remove $expand from POST/PATCH route for now

The ODATA spec is not exactly clear about the semantics here:
"The semantics of system query options applied to POST requests to
entity sets as well as all PATCH, PUT and DELETE requests are not
defined by this specification and are reserved for future versions."

And currently we don't really need that anyway.
This commit is contained in:
Ralf Haferkamp
2025-06-02 15:17:32 +02:00
parent f1fb44946c
commit 79aa0c5340
+3 -18
View File
@@ -191,10 +191,7 @@ func parseDriveRequest(r *http.Request) (*godata.GoDataRequest, bool, error) {
if err != nil {
return nil, false, errorcode.New(errorcode.InvalidRequest, err.Error())
}
expandPermissions := false
if slices.Contains(exp, "root.permissions") {
expandPermissions = true
}
expandPermissions := slices.Contains(exp, "root.permissions")
return odataReq, expandPermissions, nil
}
@@ -375,12 +372,6 @@ func (g Graph) CreateDrive(w http.ResponseWriter, r *http.Request) {
log = log.With().Str("url", webDavBaseURL.String()).Logger()
_, expandPermissions, err := parseDriveRequest(r)
if err != nil {
log.Debug().Err(err).Msg("could not create drive: error parsing odata request")
errorcode.RenderError(w, r, err)
}
us, ok := revactx.ContextGetUser(ctx)
if !ok {
log.Debug().Msg("could not create drive: invalid user")
@@ -489,7 +480,7 @@ func (g Graph) CreateDrive(w http.ResponseWriter, r *http.Request) {
}
}
spaces, err := g.formatDrives(ctx, webDavBaseURL, []*storageprovider.StorageSpace{space}, APIVersion_1, expandPermissions)
spaces, err := g.formatDrives(ctx, webDavBaseURL, []*storageprovider.StorageSpace{space}, APIVersion_1, false)
if err != nil {
log.Debug().Err(err).Msg("could not get drive: error parsing grpc response")
errorcode.GeneralException.Render(w, r, http.StatusInternalServerError, err.Error())
@@ -527,12 +518,6 @@ func (g Graph) UpdateDrive(w http.ResponseWriter, r *http.Request) {
log = log.With().Str("url", webDavBaseURL.String()).Logger()
_, expandPermissions, err := parseDriveRequest(r)
if err != nil {
log.Debug().Err(err).Msg("could not create drive: error parsing odata request")
errorcode.RenderError(w, r, err)
}
drive := libregraph.DriveUpdate{}
if err = StrictJSONUnmarshal(r.Body, &drive); err != nil {
log.Debug().Err(err).Interface("body", r.Body).Msg("could not update drive, invalid request body")
@@ -663,7 +648,7 @@ func (g Graph) UpdateDrive(w http.ResponseWriter, r *http.Request) {
}
}
spaces, err := g.formatDrives(r.Context(), webDavBaseURL, []*storageprovider.StorageSpace{resp.StorageSpace}, APIVersion_1, expandPermissions)
spaces, err := g.formatDrives(r.Context(), webDavBaseURL, []*storageprovider.StorageSpace{resp.StorageSpace}, APIVersion_1, false)
if err != nil {
log.Debug().Err(err).Msg("could not update drive: error parsing grpc response")
errorcode.GeneralException.Render(w, r, http.StatusInternalServerError, err.Error())