Skip to content

Commit 72ecbe5

Browse files
authored
Unlink broken symlinks in the assets folder (#6140)
Certain build environments, such as docker bind mounts, can create symlinks that exist, but cannot be overwritten for whatever reason. So we unlink those for Simon 🎁
1 parent e7c3742 commit 72ecbe5

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

reflex/assets.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,11 @@ def asset(
9292
if not dst_file.exists() and (
9393
not dst_file.is_symlink() or dst_file.resolve() != src_file_shared.resolve()
9494
):
95-
dst_file.symlink_to(src_file_shared)
95+
try:
96+
dst_file.symlink_to(src_file_shared)
97+
except FileExistsError:
98+
# This happens when Simon builds the app on a bind mount in a docker container.
99+
dst_file.unlink()
100+
dst_file.symlink_to(src_file_shared)
96101

97102
return f"/{external}/{subfolder}/{path}"

0 commit comments

Comments
 (0)