{"record":{"id":"2d509ff232e8722f","repo":"IceWhaleTech/CasaOS","slug":"not-support-2d509f","errorCode":null,"errorMessage":"not support","messagePattern":"not support","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/google_drive/drive.go","lineNumber":122,"sourceCode":"\t_, err := d.request(url, http.MethodPatch, func(req *resty.Request) {\n\t\treq.SetQueryParams(query)\n\t}, nil)\n\treturn err\n}\n\nfunc (d *GoogleDrive) Rename(ctx context.Context, srcObj model.Obj, newName string) error {\n\tdata := base.Json{\n\t\t\"name\": newName,\n\t}\n\turl := \"https://www.googleapis.com/drive/v3/files/\" + srcObj.GetID()\n\t_, err := d.request(url, http.MethodPatch, func(req *resty.Request) {\n\t\treq.SetBody(data)\n\t}, nil)\n\treturn err\n}\n\nfunc (d *GoogleDrive) Copy(ctx context.Context, srcObj, dstDir model.Obj) error {\n\treturn errors.New(\"not support\")\n}\n\nfunc (d *GoogleDrive) Remove(ctx context.Context, obj model.Obj) error {\n\turl := \"https://www.googleapis.com/drive/v3/files/\" + obj.GetID()\n\t_, err := d.request(url, http.MethodDelete, nil, nil)\n\treturn err\n}\n\nfunc (d *GoogleDrive) Put(ctx context.Context, dstDir model.Obj, stream model.FileStreamer, up driver.UpdateProgress) error {\n\tobj := stream.GetOld()\n\tvar (\n\t\te    Error\n\t\turl  string\n\t\tdata base.Json\n\t\tres  *resty.Response\n\t\terr  error\n\t)\n\tif obj != nil {","sourceCodeStart":104,"sourceCodeEnd":140,"githubUrl":"https://github.com/IceWhaleTech/CasaOS/blob/0d3b2f444ec0193193cf03eef6d43c6e35b0183e/drivers/google_drive/drive.go#L104-L140","documentation":"The Google Drive driver's Copy operation is intentionally unimplemented and returns a static 'not support' error. Unlike Rename/Remove (which call the Drive v3 API), Copy performs no network request. Every copy attempt on a Google Drive storage fails deterministically.","triggerScenarios":"Calling GoogleDrive.Copy(ctx, srcObj, dstDir) — e.g. the user selects a file on a Google Drive mount and chooses 'Copy'. The method returns errors.New(\"not support\") before any API call.","commonSituations":"A generic file-management layer treats all drivers as equal and routes copy to every driver; Google Drive users then see 'not support'. Also hit by 'duplicate file' features implemented on top of Copy.","solutions":["Guard the copy action on the caller side: skip or grey out copy for the Google Drive driver.","Implement Copy with the Drive API 'files.copy' endpoint (POST https://www.googleapis.com/drive/v3/files/{fileId}/copy, then PATCH the parents if the destination differs).","Emulate copy with download (Get) + upload (Put) when server-side copy is unavailable."],"exampleFix":"// before\nfunc (d *GoogleDrive) Copy(ctx context.Context, srcObj, dstDir model.Obj) error {\n\treturn errors.New(\"not support\")\n}\n\n// after\nfunc (d *GoogleDrive) Copy(ctx context.Context, srcObj, dstDir model.Obj) error {\n\turl := \"https://www.googleapis.com/drive/v3/files/\" + srcObj.GetID() + \"/copy\"\n\t_, err := d.request(url, http.MethodPost, func(req *resty.Request) {\n\t\treq.SetBody(base.Json{\"name\": srcObj.GetName(), \"parents\": []string{dstDir.GetID()}})\n\t}, nil)\n\treturn err\n}","handlingStrategy":"validation","validationCode":"if _, isGDrive := d.(*googledrive.GoogleDrive); isGDrive {\n\treturn errors.New(\"copy is not supported on Google Drive storage\")\n}","typeGuard":null,"tryCatchPattern":"if err := d.Copy(ctx, src, dst); err != nil && strings.Contains(err.Error(), \"not support\") {\n\t// permanent: report unsupported, never retry\n\treturn ErrUnsupportedOperation\n}","preventionTips":["Gate copy actions on a per-driver capability check before invoking","Implement the files/copy endpoint to remove the gap entirely"],"tags":["google-drive","driver","unimplemented","copy"],"backgroundTag":null,"analyzedSha":"0d3b2f444ec0193193cf03eef6d43c6e35b0183e","analyzedAt":"2026-08-15T13:27:57.821Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}