Item.from_external() to support BASE_URL.
This commit is contained in:
parent
267dcc3a4d
commit
df1c80fbbf
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue