mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-04-21 01:58:38 -05:00
+15
-11
@@ -616,18 +616,22 @@ func (s *svc) prepareCopy(ctx context.Context, w http.ResponseWriter, r *http.Re
|
||||
return nil
|
||||
}
|
||||
|
||||
// delete existing tree
|
||||
delReq := &provider.DeleteRequest{Ref: dstRef}
|
||||
delRes, err := s.gwClient.Delete(ctx, delReq)
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msg("error sending grpc delete request")
|
||||
w.WriteHeader(http.StatusInternalServerError)
|
||||
return nil
|
||||
}
|
||||
// delete existing tree when overwriting a directory or replacing a file with a directory
|
||||
if dstStatRes.Info.Type == provider.ResourceType_RESOURCE_TYPE_CONTAINER ||
|
||||
(dstStatRes.Info.Type == provider.ResourceType_RESOURCE_TYPE_FILE &&
|
||||
srcStatRes.Info.Type == provider.ResourceType_RESOURCE_TYPE_CONTAINER) {
|
||||
delReq := &provider.DeleteRequest{Ref: dstRef}
|
||||
delRes, err := s.gwClient.Delete(ctx, delReq)
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msg("error sending grpc delete request")
|
||||
w.WriteHeader(http.StatusInternalServerError)
|
||||
return nil
|
||||
}
|
||||
|
||||
if delRes.Status.Code != rpc.Code_CODE_OK && delRes.Status.Code != rpc.Code_CODE_NOT_FOUND {
|
||||
errors.HandleErrorStatus(log, w, delRes.Status)
|
||||
return nil
|
||||
if delRes.Status.Code != rpc.Code_CODE_OK && delRes.Status.Code != rpc.Code_CODE_NOT_FOUND {
|
||||
errors.HandleErrorStatus(log, w, delRes.Status)
|
||||
return nil
|
||||
}
|
||||
}
|
||||
} else if p := path.Dir(dstRef.Path); p != "" {
|
||||
// check if an intermediate path / the parent exists
|
||||
|
||||
Generated
Vendored
+1
@@ -148,6 +148,7 @@ type CapabilitiesFiles struct {
|
||||
Undelete ocsBool `json:"undelete" xml:"undelete"`
|
||||
Versioning ocsBool `json:"versioning" xml:"versioning"`
|
||||
Favorites ocsBool `json:"favorites" xml:"favorites"`
|
||||
FullTextSearch ocsBool `json:"full_text_search" xml:"full_text_search" mapstructure:"full_text_search"`
|
||||
Tags ocsBool `json:"tags" xml:"tags"`
|
||||
BlacklistedFiles []string `json:"blacklisted_files" xml:"blacklisted_files>element" mapstructure:"blacklisted_files"`
|
||||
TusSupport *CapabilitiesFilesTusSupport `json:"tus_support" xml:"tus_support" mapstructure:"tus_support"`
|
||||
|
||||
Reference in New Issue
Block a user