Skip to content

Commit 3c1032d

Browse files
committed
Added optional setting CKEDITOR_UPLOAD_URL and made get_media_url more robust.
1 parent 112cd2e commit 3c1032d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ckeditor/views.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ def create_thumbnail(filename):
6060
def get_media_url(path):
6161
"""
6262
Determine system file's media url.
63-
# XXX: seems very flaky, needs refactor.
6463
"""
65-
url = settings.MEDIA_URL + path.split(settings.MEDIA_ROOT)[1]
64+
base = getattr(settings, "CKEDITOR_UPLOAD_URL", settings.MEDIA_URL)
65+
url = base + os.path.basename(path)
6666
return url
6767

6868
def upload(request):

0 commit comments

Comments
 (0)