From 8ed54a088721ab8169d68011c2cca485a65b1d62 Mon Sep 17 00:00:00 2001 From: peterrrock2 <27579114+peterrrock2@users.noreply.github.com> Date: Wed, 25 Sep 2024 09:35:46 -0600 Subject: [PATCH] Address Anna cosmetic comments --- gerrydb/repos/base.py | 4 ++++ gerrydb/repos/column.py | 9 ++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/gerrydb/repos/base.py b/gerrydb/repos/base.py index 0e4b285..4e1f5a7 100644 --- a/gerrydb/repos/base.py +++ b/gerrydb/repos/base.py @@ -110,10 +110,14 @@ def write_context_wrapper(*args, **kwargs): return write_context_wrapper +# These characters are most likely to appear in the resource_id part of +# a path (typically the last segment). Exclusion of these characters +# prevents ogr2ogr fails and helps protect against malicious code injection. INVALID_PATH_SUBSTRINGS = set( { "..", " ", + ";", } ) diff --git a/gerrydb/repos/column.py b/gerrydb/repos/column.py index 48e40c7..74c97c3 100644 --- a/gerrydb/repos/column.py +++ b/gerrydb/repos/column.py @@ -139,7 +139,7 @@ def get(self, path: str) -> Column: @online def set_values( self, - path: Optional[str], + path: Optional[str] = None, namespace: Optional[str] = None, *, col: Optional[Column] = None, @@ -149,6 +149,8 @@ def set_values( Args: path: Short identifier for the column. Only this or `col` should be provided. + If both are provided, the path attribute of `col` will be used in place + of the passed `path` argument. col: `Column` metadata object. If the `path` is not provided, the column's path will be used. namespace: Namespace of the column (used when `path_or_col` is a raw path). @@ -159,7 +161,6 @@ def set_values( Raises: RequestError: If the values cannot be set on the server side. """ - assert path is None or isinstance(path, str) assert col is None or isinstance(col, Column) @@ -193,7 +194,7 @@ def set_values( @online async def async_set_values( self, - path: Optional[str], + path: Optional[str] = None, namespace: Optional[str] = None, *, col: Optional[Column] = None, @@ -204,6 +205,8 @@ async def async_set_values( Args: path: Short identifier for the column. Only this or `col` should be provided. + If both are provided, the path attribute of `col` will be used in place + of the passed `path` argument. col: `Column` metadata object. If the `path` is not provided, the column's path will be used. namespace: Namespace of the column (used when `path_or_col` is a raw path).