|
22 | 22 | # limitations under the License. |
23 | 23 |
|
24 | 24 | import os |
25 | | -import re |
26 | 25 | from base64 import b64encode, b64decode |
27 | 26 |
|
28 | 27 | import click |
|
36 | 35 | NOTEBOOK = 'NOTEBOOK' |
37 | 36 | LIBRARY = 'LIBRARY' |
38 | 37 | REPO = 'REPO' |
39 | | -LOCAL_OS_COMPATIBLE_PATH_REGEX = r'[^\w\-_\. ]' + re.escape(os.sep) |
40 | 38 |
|
41 | 39 |
|
42 | 40 | class WorkspaceFileInfo(object): |
@@ -168,16 +166,15 @@ def import_workspace_dir(self, source_path, target_path, overwrite, exclude_hidd |
168 | 166 | 'continue.').format(cur_src, extensions)) |
169 | 167 |
|
170 | 168 | def export_workspace_dir(self, source_path, target_path, overwrite, headers=None): |
171 | | - os_compatible_target_path = re.sub(LOCAL_OS_COMPATIBLE_PATH_REGEX, '_', target_path) |
172 | | - if os.path.isfile(os_compatible_target_path): |
| 169 | + if os.path.isfile(target_path): |
173 | 170 | click.echo('{} exists as a file. Skipping this subtree {}' |
174 | | - .format(os_compatible_target_path, source_path)) |
| 171 | + .format(target_path, source_path)) |
175 | 172 | return |
176 | | - if not os.path.isdir(os_compatible_target_path): |
177 | | - os.makedirs(os_compatible_target_path) |
| 173 | + if not os.path.isdir(target_path): |
| 174 | + os.makedirs(target_path) |
178 | 175 | for obj in self.list_objects(source_path, headers=headers): |
179 | 176 | cur_src = obj.path |
180 | | - cur_dst = os.path.join(os_compatible_target_path, obj.basename) |
| 177 | + cur_dst = os.path.join(target_path, obj.basename) |
181 | 178 | if obj.is_dir: |
182 | 179 | self.export_workspace_dir(cur_src, cur_dst, overwrite, headers=headers) |
183 | 180 | elif obj.is_notebook: |
|
0 commit comments