Skip to content

Commit

Permalink
Handle extra trailing slash when determining default targetpath
Browse files Browse the repository at this point in the history
Otherwise we end up with targetpath being `.`, which always exists (given it is current
working directory) and we end up with weird failures

Discovered while working on 2i2c-org/infrastructure#4576
  • Loading branch information
yuvipanda committed Aug 13, 2024
1 parent b397e4f commit b8a076b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion nbgitpuller/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,11 @@ async def get(self):
self.get_argument('subPath', '.')
app = self.get_argument('app', app_env)
parent_reldir = os.getenv('NBGITPULLER_PARENTPATH', '')
# Remove trailing slashes before determining default targetPath
# Otherwise we end up with targetpath being `.`, which always exists (given it is current
# working directory) and we end up with weird failures
targetpath = self.get_argument('targetpath', None) or \
self.get_argument('targetPath', repo.split('/')[-1])
self.get_argument('targetPath', repo.rstrip('/').split('/')[-1])

if urlPath:
path = urlPath
Expand Down

0 comments on commit b8a076b

Please sign in to comment.