Skip to content
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

Fixes directory paths with slash at the end during "archive_bag". #36

Closed
wants to merge 2 commits into from
Closed
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
3 changes: 3 additions & 0 deletions bdbag/bdbag_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,9 @@ def archive_bag(bag_path, bag_archiver):
logger.error("Error while archiving bag: %s", e)
raise e

if bag_path[-1] == os.sep:
bag_path = bag_path[:-1]

logger.info("Archiving bag (%s): %s" % (bag_archiver, bag_path))
tarmode = None
archive = None
Expand Down
8 changes: 8 additions & 0 deletions test/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,14 @@ def test_archive_bag_tar(self):
self.assertTrue(ospif(archive_file))
except Exception as e:
self.fail(get_typed_exception(e))

def test_archive_bag_tar_with_trailing_slash(self):
logger.info(self.getTestHeader('archive bag tar format'))
try:
archive_file = bdb.archive_bag(self.test_bag_dir + os.sep, 'tar')
self.assertTrue(ospif(archive_file))
except Exception as e:
self.fail(get_typed_exception(e))

def test_archive_bag_incomplete_structure(self):
logger.info(self.getTestHeader('archive incomplete bag zip format'))
Expand Down