From df1c80fbbfc04e53132088f3fe91fb204f736663 Mon Sep 17 00:00:00 2001 From: Edward Betts Date: Tue, 4 Dec 2018 15:17:47 +0000 Subject: [PATCH] Item.from_external() to support BASE_URL. --- sourcing/model.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sourcing/model.py b/sourcing/model.py index edf1aba..6d2700d 100644 --- a/sourcing/model.py +++ b/sourcing/model.py @@ -236,10 +236,13 @@ span: {},start=0,length={}'''.format(self.external_url, title_source_doc.externa @classmethod def from_external(cls, url, home=None): + base = current_app.config.get('BASE_URL') if home is None: home = url_for('view.home', _external=True) if url.startswith(home): username, _, hashid = url[len(home):].partition('/') + elif base and url.startswith(base): + username, _, hashid = url[len(base):].lstrip('/').partition('/') else: m = re_server_url.match(url) if not m: