Skip to content

Commit

Permalink
add exact filename match condition
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmetmeleq committed Oct 4, 2023
1 parent 5a5c80b commit 65ab961
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions unstructured/ingest/connector/sharepoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,10 @@ def _fetch_page(self):
# todo: improve permissions - ingestdoc matching logic
def update_permissions_data(self):
self._permissions_data = ""
permissions_dir = self.output_dir / "permissions_data"
permissions_dir = Path(self.partition_config.output_dir) / "permissions_data"
if permissions_dir.is_dir():
for filename in os.listdir(self.permissions_dir):
if self.file_path.split("/")[-1] in filename:
for filename in os.listdir(permissions_dir):
if self.file_path.split("/")[-1] == os.path.splitext(filename)[0]:
with open(permissions_dir / filename) as f:
self._permissions_data = json.loads(f.read())

Expand Down Expand Up @@ -509,7 +509,7 @@ def write_all_permissions(self, output_dir):

print("Writing permissions data to disk")
for site, drive_id, item_id, item_name in item_ids:
with open(permissions_dir / f"{item_name}_{item_id}.json", "w") as f:
with open(permissions_dir / f"{item_name}.json", "w") as f:
res = self.get_permissions_for_drive_item(site, drive_id, item_id)
if res:
json.dump(res["value"], f)

0 comments on commit 65ab961

Please sign in to comment.