Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion b2sdk/_v3/exception.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@
'UnknownHost',
'UnrecognizedBucketType',
'UnableToCreateDirectory',
'UnSyncableFilename',
'UnsupportedFilename',
'UnsatisfiableRange',
'UnusableFileName',
'interpret_b2_error',
Expand Down
4 changes: 2 additions & 2 deletions b2sdk/scan/exception.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ def __str__(self):
return "%s %s" % (self.parameter_name, self.message)


class UnSyncableFilename(B2Error):
class UnsupportedFilename(B2Error):
"""
Raised when a filename is not supported by the sync operation
Raised when a filename is not supported by the scan operation
"""

def __init__(self, message, filename):
Expand Down
20 changes: 10 additions & 10 deletions b2sdk/scan/folder.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import sys

from abc import ABCMeta, abstractmethod
from .exception import EmptyDirectory, EnvironmentEncodingError, UnSyncableFilename, NotADirectory, UnableToCreateDirectory
from .exception import EmptyDirectory, EnvironmentEncodingError, UnsupportedFilename, NotADirectory, UnableToCreateDirectory
from .path import B2SyncPath, LocalSyncPath
from .report import SyncReport
from .scan_policies import DEFAULT_SCAN_MANAGER, ScanPoliciesManager
Expand Down Expand Up @@ -148,7 +148,7 @@ def make_full_path(self, file_name):

# Ensure the new full_path is inside the self.root directory
if common_prefix != self.root:
raise UnSyncableFilename("illegal file name", full_path)
raise UnsupportedFilename("illegal file name", full_path)

return full_path

Expand Down Expand Up @@ -208,8 +208,8 @@ def _walk_relative_paths(
name = self._handle_non_unicode_file_name(name)

if '/' in name:
raise UnSyncableFilename(
"sync does not support file names that include '/'",
raise UnsupportedFilename(
"scan does not support file names that include '/'",
"%s in dir %s" % (name, local_dir)
)

Expand Down Expand Up @@ -374,18 +374,18 @@ def get_file_versions(self):
def _validate_file_name(self, file_name):
# Do not allow relative paths in file names
if RELATIVE_PATH_MATCHER.search(file_name):
raise UnSyncableFilename(
"sync does not support file names that include relative paths", file_name
raise UnsupportedFilename(
"scan does not support file names that include relative paths", file_name
)
# Do not allow absolute paths in file names
if ABSOLUTE_PATH_MATCHER.search(file_name):
raise UnSyncableFilename(
"sync does not support file names with absolute paths", file_name
raise UnsupportedFilename(
"scan does not support file names with absolute paths", file_name
)
# On Windows, do not allow drive letters in file names
if platform.system() == "Windows" and DRIVE_MATCHER.search(file_name):
raise UnSyncableFilename(
"sync does not support file names with drive letters", file_name
raise UnsupportedFilename(
"scan does not support file names with drive letters", file_name
)

def folder_type(self):
Expand Down
1 change: 1 addition & 0 deletions b2sdk/v2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
######################################################################

from b2sdk._v3 import * # noqa
from b2sdk._v3 import UnsupportedFilename as UnSyncableFilename

from .api import B2Api
from .b2http import B2Http
Expand Down
8 changes: 4 additions & 4 deletions test/unit/sync/test_exception.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
EnvironmentEncodingError,
InvalidArgument,
IncompleteSync,
UnSyncableFilename,
UnsupportedFilename,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there should be a v2 test which makes sure we return UnSyncableFilename in v2

check_invalid_argument,
)

Expand All @@ -41,10 +41,10 @@ def test_incomplete_sync(self):
except IncompleteSync as e:
assert str(e) == 'Incomplete sync: ', str(e)

def test_unsyncablefilename_error(self):
def test_unsupportedfilename_error(self):
try:
raise UnSyncableFilename('message', 'filename')
except UnSyncableFilename as e:
raise UnsupportedFilename('message', 'filename')
except UnsupportedFilename as e:
assert str(e) == 'message: filename', str(e)


Expand Down