Skip to content

Commit be8b5d7

Browse files
committed
Rename the offline format file properly
1 parent 0ad1b62 commit be8b5d7

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

readthedocs/projects/tasks/builds.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -628,13 +628,20 @@ def get_valid_artifact_types(self):
628628
},
629629
)
630630

631-
# TODO: improve this renaming :)
632631
if artifact_format_files == 1:
632+
# Rename file as "<project_slug>-<version_slug>.<artifact_type>",
633+
# which is the filename that Proxito serves for offline formats
633634
filename = list_dir[0]
634635
_, extension = filename.rsplit(".")
635-
shutil.mv(
636-
list_dir[0],
637-
f"{self.data.project.slug}-{self.data.version.slug}.{extension}",
636+
shutil.move(
637+
os.path.join(
638+
artifact_directory,
639+
list_dir[0],
640+
),
641+
os.path.join(
642+
artifact_directory,
643+
f"{self.data.project.slug}-{self.data.version.slug}.{extension}",
644+
),
638645
)
639646

640647
# If all the conditions were met, the artifact is valid

0 commit comments

Comments
 (0)