10000 make create output dir error catchable for docker usage by pchang388 · Pull Request #50 · homeylab/bookstack-file-exporter · GitHub
[go: up one dir, main page]

Skip to content

make create output dir error catchable for docker usage #50

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion bookstack_file_exporter/archiver/archiver.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,14 @@ def create_export_dir(self):
return
log.info("Creating base directory for archive: %s",
self.config.user_inputs.output_path)
util.create_dir(self.config.user_inputs.output_path)
# in docker, this may fail if the user id is not the same as the host
try:
util.create_dir(self.config.user_inputs.output_path)
except PermissionError as perm_err:
log.warning("Failed to create base directory: %s", perm_err)
log.warning("This usually occurs in docker environments, \
attempting to skip this step")
return

def get_bookstack_exports(self, page_nodes: Dict[int, Node]):
"""export all page content"""
Expand Down
2 changes: 1 addition & 1 deletion bookstack_file_exporter/archiver/page_archiver.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def archive_page_assets(self, asset_type: str, parent_path: str, page_name: str,
return {}
# use a map for faster lookup
failed_assets = {}
node_base_path = f"{self.archive_base_path}/{parent_path}/"
node_base_path = f"{self.archive_base_path}/{parent_path}"
for asset_node in asset_nodes:
try:
asset_data = self.asset_archiver.get_asset_bytes(asset_type, asset_node.url)
Expand Down
Loading
0