Skip to content

Commit

Permalink
fix: Use slashes in folder names instead of division slashes added by…
Browse files Browse the repository at this point in the history
… Gazer (#155)

* Use slashes in folder names instead of division slashes added by Gazer.

* Fall back to checking for previously imported folders where slashes might have been replaced with division slashes.

* Update PR number

Co-authored-by: Sean Rose <[email protected]>

---------

Co-authored-by: Sean Rose <[email protected]>
Co-authored-by: Sean Rose <[email protected]>
  • Loading branch information
3 people authored Dec 4, 2024
1 parent 9719386 commit 4af55da
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions looker_deployer/commands/deploy_content.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ def create_or_return_space(space_name, parent_id, sdk):

try:
target_id = get_space_ids_from_name(space_name, parent_id, sdk)
if len(target_id) == 0 and "/" in space_name:
# If the folder name contains slashes then also check if it was previously imported with
# the slashes replaced with division slashes (Unicode character 2215) prior to PR #153.
target_id = get_space_ids_from_name(space_name.replace("/", "\u2215"), parent_id, sdk)
logger.debug("Space ID from name", extra={"id": target_id})
assert len(target_id) == 1
except AssertionError as e:
Expand Down Expand Up @@ -134,6 +138,9 @@ def build_spaces(spaces, sdk):
id_tracker = ["0"]

for space in spaces:
# Gazer replaces slashes in folder names with division slashes (Unicode character 2215), so undo that.
space = space.replace("\u2215", "/")

logger.debug("parent_id to use", extra={"id_tracker": id_tracker})
# Pull last value from id_tracker
space_parent = id_tracker.pop()
Expand Down

0 comments on commit 4af55da

Please sign in to comment.