Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Update _get_parent_directory #57
  * If an existing resource is equa lto Codebase.CACHED_RESOURCE, then create that Resource

Signed-off-by: Jono Yang <[email protected]>
  • Loading branch information
JonoYang committed Aug 25, 2023
commit 7c417a8981ec11dbb400ac0693c9958618993d6b
2 changes: 1 addition & 1 deletion src/commoncode/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -2036,7 +2036,7 @@ def _get_parent_directory(self, path_segments):
for segment in path_segments:
path = posixpath_join(current.path, segment)
existing = resources_by_path.get(path)
if not existing:
if not existing or existing == Codebase.CACHED_RESOURCE:
existing = self._get_or_create_resource(
name=segment,
# build the path based on parent
Expand Down
14 changes: 2 additions & 12 deletions tests/test_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -1455,18 +1455,8 @@ def test_VirtualCodebase_can_be_created_with_repeated_root_directory(self):
paths = [
'to',
'to/to',
'to/to/com.liferay.portal.tika-1.0.22.jar',
'to/to/com.liferay.portal.tika-1.0.22.jar-extract',
'to/to/com.liferay.portal.tika-1.0.22.jar-extract/com.liferay.portal.tika-1.0.22',
'to/to/com.liferay.portal.tika-1.0.22.jar-extract/com.liferay.portal.tika-1.0.22/com',
'to/to/com.liferay.portal.tika-1.0.22.jar-extract/com.liferay.portal.tika-1.0.22/com/liferay',
'to/to/com.liferay.portal.tika-1.0.22.jar-extract/com.liferay.portal.tika-1.0.22/com/liferay/portal',
'to/to/com.liferay.portal.tika-1.0.22.jar-extract/com.liferay.portal.tika-1.0.22/com/liferay/portal/tika',
'to/to/com.liferay.portal.tika-1.0.22.jar-extract/com.liferay.portal.tika-1.0.22/com/liferay/portal/tika/internal',
'to/to/com.liferay.portal.tika-1.0.22.jar-extract/com.liferay.portal.tika-1.0.22/com/liferay/portal/tika/internal/activator',
'to/to/com.liferay.portal.tika-1.0.22.jar-extract/com.liferay.portal.tika-1.0.22/com/liferay/portal/tika/internal/activator/TikaBundleActivator.class',
'to/to/com.liferay.portal.tika-1.0.22.jar-extract/com.liferay.portal.tika-1.0.22/META-INF',
'to/to/com.liferay.portal.tika-1.0.22.jar-extract/com.liferay.portal.tika-1.0.22/META-INF/MANIFEST.MF',
'to/to/to',
'to/to/to/to',
]
resources = [{'path': path} for path in paths]
vc = VirtualCodebase(location={'files': resources})
Expand Down