From 628f92af9d01c139f06040a9bfb400c9319082f3 Mon Sep 17 00:00:00 2001 From: Max Goodman Date: Tue, 21 Jun 2011 12:36:07 -0700 Subject: [PATCH] Prevent static file name linking from operating on symlinks. --- r2/Makefile | 2 +- r2/r2/lib/static.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/r2/Makefile b/r2/Makefile index 101b4cafc..509d05cac 100644 --- a/r2/Makefile +++ b/r2/Makefile @@ -78,7 +78,7 @@ all: pyx static names $(INIS) .PHONY: pyx js css rtl static names clean clean_static all -$(NAMES): static +$(NAMES): $(JSTARGETS) $(CSSTARGETS) $(SPRITES) $(MAINCSS) $(UPDATE_NAMES) $(NAMES) $(NAMED) $(JSTARGETS): $(JSSOURCES) diff --git a/r2/r2/lib/static.py b/r2/r2/lib/static.py index f981d2c0b..8029c0a83 100755 --- a/r2/r2/lib/static.py +++ b/r2/r2/lib/static.py @@ -27,8 +27,9 @@ def update_static_names(names_file, files, make_links=False): base = os.path.dirname(names_file) for path in files: - name = os.path.relpath(path, base) - names[name] = generate_static_name(name, base) + if not os.path.islink(path): + name = os.path.relpath(path, base) + names[name] = generate_static_name(name, base) json_enc = json.JSONEncoder(indent=2, sort_keys=True) open(names_file, "w").write(json_enc.encode(names))