Skip to content

Commit e21cae8

Browse files
authored
ensure string keys
1 parent 2cf7695 commit e21cae8

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/mkdocs_git_revision_date_localized_plugin/plugin.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,9 @@ def parallel_compute_commit_timestamps(self, files, original_source: Optional[Di
154154
# Support plugins like monorep that might have moved the files from the original source that is under git
155155
if original_source and abs_src_path in original_source:
156156
abs_src_path = original_source[abs_src_path]
157-
abs_src_path = Path(abs_src_path).absolute()
158-
assert abs_src_path.exists()
159-
result = pool.apply_async(self.util.get_git_commit_timestamp, args=(str(abs_src_path), is_first_commit))
157+
assert Path(abs_src_path).exists()
158+
abs_src_path = str(Path(abs_src_path).absolute())
159+
result = pool.apply_async(self.util.get_git_commit_timestamp, args=(abs_src_path, is_first_commit))
160160
results.append((abs_src_path, result))
161161
pool.close()
162162
pool.join()
@@ -240,7 +240,7 @@ def on_page_markdown(self, markdown: str, page: Page, config: config_options.Con
240240
last_revision_hash, last_revision_timestamp = "", int(time.time())
241241
else:
242242
last_revision_hash, last_revision_timestamp = self.last_revision_commits.get(
243-
page.file.abs_src_path, (None, None)
243+
str(Path(page.file.abs_src_path).absolute()), (None, None)
244244
)
245245
if last_revision_timestamp is None:
246246
last_revision_hash, last_revision_timestamp = self.util.get_git_commit_timestamp(
@@ -316,7 +316,7 @@ def on_page_markdown(self, markdown: str, page: Page, config: config_options.Con
316316
first_revision_hash, first_revision_timestamp = "", int(time.time())
317317
else:
318318
first_revision_hash, first_revision_timestamp = self.created_commits.get(
319-
page.file.abs_src_path, (None, None)
319+
str(Path(page.file.abs_src_path).absolute()), (None, None)
320320
)
321321
if first_revision_timestamp is None:
322322
first_revision_hash, first_revision_timestamp = self.util.get_git_commit_timestamp(

tests/fixtures/monorepo/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
site/
2+
build/

0 commit comments

Comments
 (0)