Skip to content

Commit

Permalink
Merge pull request #257 from astronomy-commons/fix-full-file-pointer
Browse files Browse the repository at this point in the history
Prepend file protocol to pointer
  • Loading branch information
camposandro authored Apr 12, 2024
2 parents 10e527d + 5adde76 commit af5806a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/hipscat/io/file_io/file_pointer.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,12 @@ def get_file_pointer_for_fs(protocol: str, file_pointer: FilePointer) -> FilePoi
return FilePointer(split_pointer)


def get_full_file_pointer(incomplete_path: str, protocol_path: str) -> FilePointer:
def get_full_file_pointer(path: str, protocol_path: str) -> FilePointer:
"""Rebuilds the file_pointer with the protocol and account name if required"""
protocol = get_file_protocol(protocol_path)
return FilePointer(f"{protocol}://{incomplete_path}")
if not path.startswith(protocol):
path = f"{protocol}://{path}"
return FilePointer(path)


def get_file_pointer_from_path(path: str, include_protocol: str = None) -> FilePointer:
Expand Down

0 comments on commit af5806a

Please sign in to comment.