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

Fix loading/clearing of media files #2297

Merged
merged 2 commits into from
Sep 19, 2024
Merged

Fix loading/clearing of media files #2297

merged 2 commits into from
Sep 19, 2024

Conversation

bemoody
Copy link
Collaborator

@bemoody bemoody commented Sep 19, 2024

Currently, manage.py loaddemo incorrectly creates a file (not a directory) called media/ethics.

Even worse, manage.py resetdb currently crashes if that file exists.

Fixes #2247

Benjamin Moody added 2 commits September 19, 2024 15:55
If demo files are placed in first-level subdirectories of the media
directory, they were not being copied correctly when loading the demo.
For example, "demo-files/media/ethics/Ethics_Approval_....txt" was
incorrectly copied as "media/ethics" rather than
"media/ethics/Ethics_Approval_....txt".

Additionally, ensure that the destination directories are created if
they don't already exist.
Previously, resetdb would fail if the media directory contained
something that wasn't a subdirectory (such as a file called "ethics"
that was created by a buggy version of loaddemo.)

We can simplify this function enormously - what we really want is to
delete *everything* except for ".gitkeep" files.
@tompollard
Copy link
Member

looks good to me, thanks

@tompollard tompollard merged commit 3b76b1d into dev Sep 19, 2024
8 checks passed
@tompollard tompollard deleted the bm/loaddemo branch September 19, 2024 20:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

loaddemo installing weird "ethics" file
2 participants