Commit d6ba3715 by Antonin Lenfant Committed by benjaoming

Fix image upload when IMAGE_PATH_OBSCURIFY setting is enabled

parent 4c54b9a4
...@@ -20,9 +20,8 @@ def upload_path(instance, filename): ...@@ -20,9 +20,8 @@ def upload_path(instance, filename):
upload_path = settings.IMAGE_PATH upload_path = settings.IMAGE_PATH
upload_path = upload_path.replace('%aid', str(instance.plugin.image.article.id)) upload_path = upload_path.replace('%aid', str(instance.plugin.image.article.id))
if settings.IMAGE_PATH_OBSCURIFY: if settings.IMAGE_PATH_OBSCURIFY:
import random, hashlib import uuid
m=hashlib.md5(str(random.randint(0,100000000000000))) upload_path = os.path.join(upload_path, uuid.uuid4().hex)
upload_path = os.path.join(upload_path, m.hexdigest())
return os.path.join(upload_path, filename) return os.path.join(upload_path, filename)
class Image(RevisionPlugin): class Image(RevisionPlugin):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment