Skip to content

bucket.move_blob not working with url encoded chars in blob name #1523

@Voldurk

Description

@Voldurk

bucket.move_blob not working with url encoded chars in blob name
getting NotFound: 404 POST https://storage.googleapis.com/storage/v1/b/[*bucket_name*]/o/test%2Fblob.csv/moveTo/o/test/blob2.csv?prettyPrint=false: Not Found

Base on the docs (https://cloud.google.com/storage/docs/copying-renaming-moving-objects#move-by-copying), the URL is not correctly encoded:
DESTINATION_OBJECT_NAME is the URL-encoded name you want to use. For example, pets/cat.png, URL-encoded as pets%2Fcat.png.

Environment details

  • OS type and version: macOS Sequoia 15.6
  • Python version: 3.12.9
  • pip version: 24.0
  • google-cloud-storage version: 3.3.0

Steps to reproduce

  1. Create a blob with "/" in the name
  2. try to move it with bucket.move_blob

Code example

from google.cloud import storage
gcs = storage.Client()
bucket = gcs.bucket("")
blob = bucket.get_blob("test/blob.csv")
bucket.move_blob(
    blob, 
    new_name="test/blob2.csv"
)

Making sure to follow these steps will guarantee the quickest resolution possible.

Thanks!

Metadata

Metadata

Assignees

Labels

api: storageIssues related to the googleapis/python-storage API.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions