@@ -111,9 +111,8 @@ func resourcePasteHandler(fileCache fileutils.FileCache) handleFunc {
111
111
return common .RenderJSON (w , r , response )
112
112
}
113
113
114
- override := r .URL .Query ().Get ("override" ) == "true"
115
114
rename := r .URL .Query ().Get ("rename" ) == "true"
116
- if ! override && ! rename {
115
+ if ! rename {
117
116
if _ , err := files .DefaultFs .Stat (dst ); err == nil {
118
117
return http .StatusConflict , nil
119
118
}
@@ -142,10 +141,6 @@ func resourcePasteHandler(fileCache fileutils.FileCache) handleFunc {
142
141
if rename && dstType != "google" {
143
142
dst = pasteAddVersionSuffix (dst , dstType , files .DefaultFs , w , r )
144
143
}
145
- // Permission for overwriting the file
146
- if override {
147
- return http .StatusForbidden , nil
148
- }
149
144
var same = srcType == dstType
150
145
// all cloud drives of two users must be seen as diff archs
151
146
var srcName , dstName string
@@ -164,7 +159,7 @@ func resourcePasteHandler(fileCache fileutils.FileCache) handleFunc {
164
159
}
165
160
166
161
if same {
167
- err = pasteActionSameArch (r .Context (), action , srcType , src , dstType , dst , d , fileCache , override , rename , w , r )
162
+ err = pasteActionSameArch (r .Context (), action , srcType , src , dstType , dst , d , fileCache , rename , w , r )
168
163
} else {
169
164
err = pasteActionDiffArch (r .Context (), action , srcType , src , dstType , dst , d , fileCache , w , r )
170
165
}
@@ -1040,11 +1035,11 @@ func moveDelete(fileCache fileutils.FileCache, srcType, src string, ctx context.
1040
1035
return os .ErrInvalid
1041
1036
}
1042
1037
1043
- func pasteActionSameArch (ctx context.Context , action , srcType , src , dstType , dst string , d * common.Data , fileCache fileutils.FileCache , override , rename bool , w http.ResponseWriter , r * http.Request ) error {
1038
+ func pasteActionSameArch (ctx context.Context , action , srcType , src , dstType , dst string , d * common.Data , fileCache fileutils.FileCache , rename bool , w http.ResponseWriter , r * http.Request ) error {
1044
1039
klog .Infoln ("Now deal with " , action , " for same arch " , dstType )
1045
- klog .Infoln ("src: " , src , ", dst: " , dst , ", override: " , override )
1040
+ klog .Infoln ("src: " , src , ", dst: " , dst )
1046
1041
if srcType == "drive" || srcType == "cache" {
1047
- patchUrl := "http://127.0.0.1:80/api/resources/" + common .EscapeURLWithSpace (strings .TrimLeft (src , "/" )) + "?action=" + action + "&destination=" + common .EscapeURLWithSpace (dst ) + "&override=" + strconv . FormatBool ( override ) + "& rename=" + strconv .FormatBool (rename )
1042
+ patchUrl := "http://127.0.0.1:80/api/resources/" + common .EscapeURLWithSpace (strings .TrimLeft (src , "/" )) + "?action=" + action + "&destination=" + common .EscapeURLWithSpace (dst ) + "&rename=" + strconv .FormatBool (rename )
1048
1043
method := "PATCH"
1049
1044
payload := []byte (`` )
1050
1045
klog .Infoln (patchUrl )
0 commit comments