Revert "Replaced config SCHEME with Flask's own PREFERRED_URL_SCHEME setting."

This reverts commit 8318d4b1f69846e21002acafd4f410f5003af6f6.
This commit is contained in:
Sybren A. Stüvel 2017-09-01 16:19:58 +02:00
parent fe64a0c70e
commit 3a3b3c3269
5 changed files with 10 additions and 6 deletions

View File

@ -364,7 +364,8 @@ def generate_link(backend, file_path: str, project_id=None, is_public=False) ->
return blob.get_url(is_public=is_public)
if backend == 'pillar':
return url_for('file_storage.index', file_name=file_path, _external=True)
return url_for('file_storage.index', file_name=file_path,
_external=True, _scheme=current_app.config['SCHEME'])
if backend == 'cdnsun':
return hash_file_path(file_path, None)
if backend == 'unittest':

View File

@ -34,7 +34,7 @@ class LocalBucket(Bucket):
def copy_blob(self, blob: Blob, to_bucket: Bucket):
"""Copies a blob from the current bucket to the other bucket.
Implementations only need to support copying between buckets of the
same storage backend.
"""
@ -73,7 +73,8 @@ class LocalBlob(Blob):
from flask import url_for
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
def create_from_file(self, file_obj: FileType, *,

View File

@ -74,7 +74,8 @@ class OAuthSignIn(metaclass=abc.ABCMeta):
pass
def get_callback_url(self):
return url_for('users.oauth_callback', provider=self.provider_name, _external=True)
return url_for('users.oauth_callback', provider=self.provider_name,
_external=True, _scheme=current_app.config['SCHEME'])
@staticmethod
def auth_code_from_request() -> str:

View File

@ -12,7 +12,7 @@ import requests.certs
RFC1123_DATE_FORMAT = '%a, %d %b %Y %H:%M:%S GMT'
PILLAR_SERVER_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
PREFERRED_URL_SCHEME = 'https'
SCHEME = 'https'
STORAGE_DIR = getenv('PILLAR_STORAGE_DIR', '/data/storage/pillar')
PORT = 5000
HOST = '0.0.0.0'

View File

@ -412,7 +412,8 @@ def edit(node_id):
else:
project_update_nodes_list(node, project_id=project._id)
return redirect(url_for('nodes.view', node_id=node_id, embed=1,
_external=True))
_external=True,
_scheme=current_app.config['SCHEME']))
else:
log.debug('Error sending data to Pillar, see Pillar logs.')
error = 'Server error'