Skip to content
This repository has been archived by the owner on Dec 7, 2022. It is now read-only.

Commit

Permalink
Fix modulemd_defaults upload/copy collision traceback
Browse files Browse the repository at this point in the history
closes #5658

(cherry picked from commit bbc8460)
  • Loading branch information
ggainey authored and evgeni committed Feb 24, 2020
1 parent cd066aa commit f8d80eb
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion server/pulp/server/db/model/__init__.py
Expand Up @@ -883,7 +883,15 @@ def set_storage_path(self, filename=None):
path = FileStorage.get_path(self)
if filename:
if not os.path.isabs(filename):
path = os.path.join(path, filename)
if not os.path.exists(path) or os.path.isdir(path):
# If place-to-store doesn't exist yet, or is a directory, just append filename
path = os.path.join(path, filename)
else:
# If we're here, place-to-store exists and is a *file*. This can happen
# if, for example, we're dealing with modulemd_defaults. This is something
# of a hack on top of the already 'total hack' that is this method.
# See https://pulp.plan.io/issues/5658
path = os.path.join(os.path.dirname(path), filename)
else:
raise ValueError(_('must be relative path'))
self._storage_path = path
Expand Down

0 comments on commit f8d80eb

Please sign in to comment.