Skip to content

Commit

Permalink
Make certain ingested paths are relative to root.
Browse files Browse the repository at this point in the history
  • Loading branch information
TallJimbo committed Aug 8, 2018
1 parent 202ea4c commit 93dd568
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion python/lsst/daf/butler/datastores/posixDatastore.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,8 +397,9 @@ def ingest(self, path, ref, formatter=None, transfer=None):
if transfer is None:
if os.path.isabs(path):
absRoot = os.path.abspath(self.root)
if os.path.commonpath([absRoot, os.path.abspath(path)]) != absRoot:
if os.path.commonpath([absRoot, path]) != absRoot:
raise RuntimeError("'{}' is not inside repository root '{}'".format(path, self.root))
path = os.path.relpath(path, absRoot)
else:
template = self.templates.getTemplate(ref.datasetType.name)
location = self.locationFactory.fromPath(template.format(ref))
Expand Down

0 comments on commit 93dd568

Please sign in to comment.