IceWhaleTech/CasaOS · error

not support

Error message

not support

What it means

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.

Source

Thrown at drivers/google_drive/drive.go:122

	_, err := d.request(url, http.MethodPatch, func(req *resty.Request) {
		req.SetQueryParams(query)
	}, nil)
	return err
}

func (d *GoogleDrive) Rename(ctx context.Context, srcObj model.Obj, newName string) error {
	data := base.Json{
		"name": newName,
	}
	url := "https://www.googleapis.com/drive/v3/files/" + srcObj.GetID()
	_, err := d.request(url, http.MethodPatch, func(req *resty.Request) {
		req.SetBody(data)
	}, nil)
	return err
}

func (d *GoogleDrive) Copy(ctx context.Context, srcObj, dstDir model.Obj) error {
	return errors.New("not support")
}

func (d *GoogleDrive) Remove(ctx context.Context, obj model.Obj) error {
	url := "https://www.googleapis.com/drive/v3/files/" + obj.GetID()
	_, err := d.request(url, http.MethodDelete, nil, nil)
	return err
}

func (d *GoogleDrive) Put(ctx context.Context, dstDir model.Obj, stream model.FileStreamer, up driver.UpdateProgress) error {
	obj := stream.GetOld()
	var (
		e    Error
		url  string
		data base.Json
		res  *resty.Response
		err  error
	)
	if obj != nil {

View on GitHub (pinned to 0d3b2f444e)

Solutions

  1. Guard the copy action on the caller side: skip or grey out copy for the Google Drive driver.
  2. 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).
  3. Emulate copy with download (Get) + upload (Put) when server-side copy is unavailable.

Example fix

// before
func (d *GoogleDrive) Copy(ctx context.Context, srcObj, dstDir model.Obj) error {
	return errors.New("not support")
}

// after
func (d *GoogleDrive) Copy(ctx context.Context, srcObj, dstDir model.Obj) error {
	url := "https://www.googleapis.com/drive/v3/files/" + srcObj.GetID() + "/copy"
	_, err := d.request(url, http.MethodPost, func(req *resty.Request) {
		req.SetBody(base.Json{"name": srcObj.GetName(), "parents": []string{dstDir.GetID()}})
	}, nil)
	return err
}
Defensive patterns

Strategy: validation

Validate before calling

if _, isGDrive := d.(*googledrive.GoogleDrive); isGDrive {
	return errors.New("copy is not supported on Google Drive storage")
}

Try / catch

if err := d.Copy(ctx, src, dst); err != nil && strings.Contains(err.Error(), "not support") {
	// permanent: report unsupported, never retry
	return ErrUnsupportedOperation
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of IceWhaleTech/CasaOS@0d3b2f444e (2026-08-15). Data as JSON: /api/errors/2d509ff232e8722f. Report an issue: GitHub.