Replaced config SCHEME with Flask's own PREFERRED_URL_SCHEME setting.
This prevents us from explicitly passing SCHEME to url_for() calls. NOTE: this possibly requires an update to your config_local.py
This commit is contained in:
parent
d6dd0d69d0
commit
8318d4b1f6
@ -364,8 +364,7 @@ def generate_link(backend, file_path: str, project_id=None, is_public=False) ->
|
|||||||
return blob.get_url(is_public=is_public)
|
return blob.get_url(is_public=is_public)
|
||||||
|
|
||||||
if backend == 'pillar':
|
if backend == 'pillar':
|
||||||
return url_for('file_storage.index', file_name=file_path,
|
return url_for('file_storage.index', file_name=file_path, _external=True)
|
||||||
_external=True, _scheme=current_app.config['SCHEME'])
|
|
||||||
if backend == 'cdnsun':
|
if backend == 'cdnsun':
|
||||||
return hash_file_path(file_path, None)
|
return hash_file_path(file_path, None)
|
||||||
if backend == 'unittest':
|
if backend == 'unittest':
|
||||||
|
@ -34,7 +34,7 @@ class LocalBucket(Bucket):
|
|||||||
|
|
||||||
def copy_blob(self, blob: Blob, to_bucket: Bucket):
|
def copy_blob(self, blob: Blob, to_bucket: Bucket):
|
||||||
"""Copies a blob from the current bucket to the other bucket.
|
"""Copies a blob from the current bucket to the other bucket.
|
||||||
|
|
||||||
Implementations only need to support copying between buckets of the
|
Implementations only need to support copying between buckets of the
|
||||||
same storage backend.
|
same storage backend.
|
||||||
"""
|
"""
|
||||||
@ -73,8 +73,7 @@ class LocalBlob(Blob):
|
|||||||
from flask import url_for
|
from flask import url_for
|
||||||
|
|
||||||
path = self.bucket.bucket_path / self.partial_path
|
path = self.bucket.bucket_path / self.partial_path
|
||||||
url = url_for('file_storage.index', file_name=str(path), _external=True,
|
url = url_for('file_storage.index', file_name=str(path), _external=True)
|
||||||
_scheme=current_app.config['SCHEME'])
|
|
||||||
return url
|
return url
|
||||||
|
|
||||||
def create_from_file(self, file_obj: FileType, *,
|
def create_from_file(self, file_obj: FileType, *,
|
||||||
|
@ -74,8 +74,7 @@ class OAuthSignIn(metaclass=abc.ABCMeta):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def get_callback_url(self):
|
def get_callback_url(self):
|
||||||
return url_for('users.oauth_callback', provider=self.provider_name,
|
return url_for('users.oauth_callback', provider=self.provider_name, _external=True)
|
||||||
_external=True, _scheme=current_app.config['SCHEME'])
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def auth_code_from_request() -> str:
|
def auth_code_from_request() -> str:
|
||||||
|
@ -12,7 +12,7 @@ import requests.certs
|
|||||||
RFC1123_DATE_FORMAT = '%a, %d %b %Y %H:%M:%S GMT'
|
RFC1123_DATE_FORMAT = '%a, %d %b %Y %H:%M:%S GMT'
|
||||||
PILLAR_SERVER_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
PILLAR_SERVER_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||||
|
|
||||||
SCHEME = 'https'
|
PREFERRED_URL_SCHEME = 'https'
|
||||||
STORAGE_DIR = getenv('PILLAR_STORAGE_DIR', '/data/storage/pillar')
|
STORAGE_DIR = getenv('PILLAR_STORAGE_DIR', '/data/storage/pillar')
|
||||||
PORT = 5000
|
PORT = 5000
|
||||||
HOST = '0.0.0.0'
|
HOST = '0.0.0.0'
|
||||||
|
@ -412,8 +412,7 @@ def edit(node_id):
|
|||||||
else:
|
else:
|
||||||
project_update_nodes_list(node, project_id=project._id)
|
project_update_nodes_list(node, project_id=project._id)
|
||||||
return redirect(url_for('nodes.view', node_id=node_id, embed=1,
|
return redirect(url_for('nodes.view', node_id=node_id, embed=1,
|
||||||
_external=True,
|
_external=True))
|
||||||
_scheme=current_app.config['SCHEME']))
|
|
||||||
else:
|
else:
|
||||||
log.debug('Error sending data to Pillar, see Pillar logs.')
|
log.debug('Error sending data to Pillar, see Pillar logs.')
|
||||||
error = 'Server error'
|
error = 'Server error'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user