From d99aef1415553249183f13af8883fae859d3a897 Mon Sep 17 00:00:00 2001 From: Adarsh Pathak Date: Thu, 4 Oct 2018 18:01:20 +0530 Subject: [PATCH] Addresses #115: Removes any unicode symbols from path. --- src/onedrivesdk/extensions/drive_request_builder_helper.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/onedrivesdk/extensions/drive_request_builder_helper.py b/src/onedrivesdk/extensions/drive_request_builder_helper.py index b65dde0..52e6ee8 100644 --- a/src/onedrivesdk/extensions/drive_request_builder_helper.py +++ b/src/onedrivesdk/extensions/drive_request_builder_helper.py @@ -28,16 +28,17 @@ def item_by_path(self, path): """Get an item by path in OneDrive - + Args path (str): The path to the requested item - Returns: + Returns: :class:`ItemRequestBuilder`: A request builder for an item given a path """ #strip any leading '/' - path = str(path)[1:] if str(path)[0] == "/" else str(path) + path = str(path.encode("ascii", "ignore").decode("utf8"))[1:] if str(path.encode( + "ascii", "ignore").decode("utf8"))[0] == "/" else str(path.encode("ascii", "ignore").decode("utf8")) return ItemRequestBuilder(self.append_to_request_url("root:/"+str(path)+":"), self._client) DriveRequestBuilder.item_by_path = item_by_path