parent
46f150cafb
commit
f0c8552668
1 changed files with 7 additions and 2 deletions
|
@ -1,11 +1,13 @@
|
|||
import os
|
||||
import logging
|
||||
import magic
|
||||
import urlparse
|
||||
|
||||
from uuid import uuid4
|
||||
from flask import url_for, request, send_file, make_response, abort
|
||||
from flask.views import View
|
||||
from _pyio import BufferedReader
|
||||
from util import get_app_url
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
@ -77,7 +79,9 @@ class DelegateUserfiles(object):
|
|||
if url is None:
|
||||
with self._app.app_context() as ctx:
|
||||
ctx.url_adapter = self._build_url_adapter()
|
||||
return (url_for(self._handler_name, file_id=file_id, _external=True), file_id)
|
||||
file_relative_url = url_for(self._handler_name, file_id=file_id)
|
||||
file_url = urlparse.urljoin(get_app_url(self._app.config), file_relative_url)
|
||||
return (file_url, file_id)
|
||||
|
||||
return (url, file_id)
|
||||
|
||||
|
@ -97,7 +101,8 @@ class DelegateUserfiles(object):
|
|||
if url is None:
|
||||
with self._app.app_context() as ctx:
|
||||
ctx.url_adapter = self._build_url_adapter()
|
||||
return url_for(self._handler_name, file_id=file_id, _external=True)
|
||||
file_relative_url = url_for(self._handler_name, file_id=file_id)
|
||||
return urlparse.urljoin(get_app_url(self._app.config), file_relative_url)
|
||||
|
||||
return url
|
||||
|
||||
|
|
Reference in a new issue