Skip to content

Commit f115980

Browse files
committed
support special characters when copying, moving, renaming, sharing and deleting files
1 parent d22dcba commit f115980

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

cterasdk/cio/core.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ def makedir(path):
210210
@contextmanager
211211
def rename(path, name):
212212
param = ActionResourcesParam.instance()
213-
param.add(SrcDstParam.instance(src=path.absolute, dest=path.parent.join(name).absolute))
213+
param.add(SrcDstParam.instance(src=path.absolute_encode, dest=path.parent.join(name).absolute_encode))
214214
logger.info('Renaming item: %s to: %s', path.reference.as_posix(), name)
215215
yield param
216216

@@ -219,7 +219,7 @@ def _delete_or_recover(paths, *, message=None):
219219
param = ActionResourcesParam.instance()
220220
paths = [paths] if not isinstance(paths, list) else paths
221221
for path in paths:
222-
param.add(SrcDstParam.instance(src=path.absolute))
222+
param.add(SrcDstParam.instance(src=path.absolute_encode))
223223
if message:
224224
logger.info('%s: %s', message, path.reference.as_posix())
225225
yield param
@@ -239,7 +239,7 @@ def _copy_or_move(paths, destination, *, message=None):
239239
param = ActionResourcesParam.instance()
240240
paths = [paths] if not isinstance(paths, list) else paths
241241
for path in paths:
242-
param.add(SrcDstParam.instance(src=path.absolute, dest=destination.join(path.name).absolute))
242+
param.add(SrcDstParam.instance(src=path.absolute_encode, dest=destination.join(path.name).absolute_encode))
243243
if message:
244244
logger.info('%s from: %s to: %s', message, path.reference.as_posix(), destination.join(path.name).reference.as_posix())
245245
yield param
@@ -260,7 +260,7 @@ def public_link(path, access, expire_in):
260260
access = {'RO': 'ReadOnly', 'RW': 'ReadWrite', 'PO': 'PreviewOnly'}.get(access)
261261
expire_on = DateTimeUtils.get_expiration_date(expire_in).strftime('%Y-%m-%d')
262262
logger.info('Creating Public Link for: %s. Access: %s. Expires: %s', path.reference.as_posix(), access, expire_on)
263-
param = CreateShareParam.instance(path=path.absolute, access=access, expire_on=expire_on)
263+
param = CreateShareParam.instance(path=path.absolute_encode, access=access, expire_on=expire_on)
264264
yield param
265265

266266

@@ -320,7 +320,7 @@ def share(path, as_project, allow_reshare, allow_sync, shares=None):
320320

321321
param = Object()
322322
param._classname = 'ShareResourceParam' # pylint: disable=protected-access
323-
param.url = path.absolute
323+
param.url = path.absolute_encode
324324
param.teamProject = as_project
325325
param.allowReshare = allow_reshare
326326
param.shouldSync = allow_sync

0 commit comments

Comments
 (0)