embed.sanitizer: fix double-slash on path

- run: add app.session
This commit is contained in:
Luna 2018-12-05 03:08:54 -03:00
parent 75a7c4d83a
commit e2720a4084
2 changed files with 5 additions and 2 deletions

View File

@ -65,7 +65,7 @@ def proxify(url) -> str:
return (
# base mediaproxy url
f'{proto}://{md_base_url}/img/'
f'{parsed.scheme}/{parsed.netloc}/{parsed.path}'
f'{parsed.scheme}/{parsed.netloc}{parsed.path}'
)
@ -73,7 +73,7 @@ async def fetch_metadata(url) -> dict:
"""Fetch metadata for a url."""
parsed = url.parsed
md_path = f'{parsed.scheme}/{parsed.netloc}/{parsed.path}'
md_path = f'{parsed.scheme}/{parsed.netloc}{parsed.path}'
md_base_url = app.config['MEDIA_PROXY']
proto = 'https' if app.config['IS_SSL'] else 'http'

3
run.py
View File

@ -8,6 +8,7 @@ import websockets
from quart import Quart, g, jsonify, request
from logbook import StreamHandler, Logger
from logbook.compat import redirect_logging
from aiohttp import ClientSession
# import the config set by instance owner
import config
@ -281,6 +282,8 @@ async def app_before_serving():
g.app = app
g.loop = asyncio.get_event_loop()
app.session = ClientSession()
init_app_managers(app)
# start the websocket, etc