-
Notifications
You must be signed in to change notification settings - Fork 102
🐛 Fix Consecutive Annotations Load Bug #927
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -482,7 +482,7 @@ def load_annotations(self: TileServer) -> str: | |
| file_path, | ||
| np.array(model_mpp) / np.array(self.slide_mpps[session_id]), | ||
| ) | ||
| tmp_path = Path(tempfile.gettempdir()) / "temp.db" | ||
| tmp_path = Path(tempfile.gettempdir()) / f"temp_{session_id}.db" | ||
| sq.dump(tmp_path) | ||
| sq = SQLiteStore(tmp_path) | ||
| self.pyramids[session_id]["overlay"] = AnnotationTileGenerator( | ||
|
|
@@ -536,7 +536,7 @@ def change_overlay(self: TileServer) -> str: | |
| sq = SQLiteStore(overlay_path, auto_commit=False) | ||
| else: | ||
| # make a temporary db for the new annotations | ||
| tmp_path = Path(tempfile.gettempdir()) / "temp.db" | ||
| tmp_path = Path(tempfile.gettempdir()) / f"temp_{session_id}.db" | ||
|
||
| sq.dump(tmp_path) | ||
| sq = SQLiteStore(tmp_path) | ||
|
|
||
|
|
@@ -621,7 +621,7 @@ def commit_db(self: TileServer) -> str: | |
| if isinstance(layer, AnnotationTileGenerator): | ||
| if ( | ||
| layer.store.path.suffix == ".db" | ||
| and layer.store.path.name != "temp.db" | ||
| and layer.store.path.name != f"temp_{session_id}.db" | ||
| ): | ||
| logger.info("%s*.db committed.", layer.store.path.stem) | ||
| layer.store.commit() | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ensure that session_id is sanitized or validated before using it in the file name to prevent potential file path injection vulnerabilities.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tiatoolbox code generates the session ID, so this is not a concern.