B2_Command_Line_Tool icon indicating copy to clipboard operation
B2_Command_Line_Tool copied to clipboard

Obscure and Annoying Errors

Open JohnRobson opened this issue 6 years ago • 2 comments

File "/usr/lib/python2.7/site-packages/b2/bucket.py", line 374, in upload
    validate_b2_file_name(file_name)
  File "/usr/lib/python2.7/site-packages/b2/utils.py", line 168, in validate_b2_file_name
    raise ValueError("file names segments (between '/') can be at most 250 utf-8 bytes")
ValueError: file names segments (between '/') can be at most 250 utf-8 bytes
ERROR:b2.sync.action:an exception occurred in a sync action
File "/usr/lib/python2.7/site-packages/b2/bucket.py", line 374, in upload
    validate_b2_file_name(file_name)
  File "/usr/lib/python2.7/site-packages/b2/utils.py", line 162, in validate_b2_file_name
    raise ValueError("file names must not contain '\\'")
ValueError: file names must not contain '\

Maybe you can handle (try...catch) these errors and just output a warning with the full "file_path/name".

JohnRobson avatar Jan 02 '19 05:01 JohnRobson

The fix may be as simple as raising UnusableFileName instead of a ValueError. Exceptions that are subclasses of B2Error are reported more cleanly, without the ugly stack trace.

bwbeach avatar Jan 03 '19 17:01 bwbeach

I noticed it also throws an exception for the Mac Os Icon file ('Icon?') which has a carriage return in the file name. This may be a common item to fail gracefully, or ignore.

sirleech avatar Apr 10 '20 21:04 sirleech

Related code is currently being worked on and will be part of next release (b2 4.0) - all "invalid" filenames will be reported as warnings and won't stop sync from continuing.

b2v3 will report status code 0 (i.e. success) in case of warnings emitted to preserve backwards compatibility where we emitted access-permission warnings, but still reported success b2v4 will report status code 1 (fail) in case of any file-access/filename encoding warnings.

mjurbanski-reef avatar May 04 '24 08:05 mjurbanski-reef