sibblegp/b2blaze

Delete file: B2RequestError: 400 - File not present

Opened this issue · 0 comments

Hey there. Another one for today.

Edit: Looks like this is an issue on filenames with spaces. Adjusted original post accordingly.

Delete file fails (for filename containing spaces) with B2RequestError: 400 - File not present

Is this normal/expected behavior with object storage? (ie: Do we always need to clean filenames? Or should this be considered a bug?)

Code:

from b2blaze import B2
b2 = B2(key_id=id, application_key=key)
bucket = b2.buckets.get('some_bucket')
files = bucket.files.all()
>>> files[0].file_name
'a text file.1.txt'  # Note spaces in filename

>>> files[0].delete()
Resetting dropped connection: api002.backblazeb2.com
https://api002.backblazeb2.com:443 "POST /b2api/v1/b2_delete_file_version HTTP/1.1" 400 189
Traceback (most recent call last):
   [...]
    raise B2RequestError(decode_error(response))
b2blaze.b2_exceptions.B2RequestError: 400 - {'code': 'file_not_present', 'status': 400, 'message': 'File not present: a%20text%20file.1.txt [snip...file id] '}