Skip to content

Commit 9e317a9

Browse files
authored
Merge pull request #356 from yuvipanda/fix-trailing
Handle extra trailing slash when determining default targetpath
2 parents b397e4f + b8a076b commit 9e317a9

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

nbgitpuller/handlers.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,11 @@ async def get(self):
154154
self.get_argument('subPath', '.')
155155
app = self.get_argument('app', app_env)
156156
parent_reldir = os.getenv('NBGITPULLER_PARENTPATH', '')
157+
# Remove trailing slashes before determining default targetPath
158+
# Otherwise we end up with targetpath being `.`, which always exists (given it is current
159+
# working directory) and we end up with weird failures
157160
targetpath = self.get_argument('targetpath', None) or \
158-
self.get_argument('targetPath', repo.split('/')[-1])
161+
self.get_argument('targetPath', repo.rstrip('/').split('/')[-1])
159162

160163
if urlPath:
161164
path = urlPath

0 commit comments

Comments
 (0)