Skip to content

Commit

Permalink
Backport PR #1341 on 0.6.x (Make format_path behave the same for abso…
Browse files Browse the repository at this point in the history
…lute paths with and

 without escape=True)
  • Loading branch information
BertR committed Mar 16, 2021
1 parent 07aff67 commit 9702c57
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions nbgrader/coursedir.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,9 +306,12 @@ def format_path(self, nbgrader_step, student_id, assignment_id, escape=False):
)

if escape:
base = re.escape(self.root)
structure = [x.format(**kwargs) for x in full_split(self.directory_structure)]
path = re.escape(os.path.sep).join([base] + structure)
if len(structure) == 0 or not structure[0].startswith(os.sep):
base = [re.escape(self.root)]
else:
base = []
path = re.escape(os.path.sep).join(base + structure)
else:
path = os.path.join(self.root, self.directory_structure).format(**kwargs)

Expand Down

0 comments on commit 9702c57

Please sign in to comment.