mirror of
https://github.com/inventree/InvenTree.git
synced 2025-05-02 05:26:45 +00:00
* Improve handling for raw github repo links * Fix strict mode (cherry picked from commit b1a5b1a3bb8ca6e9ee6ca047e73bf75d288a840f) Co-authored-by: Oliver <oliver.henry.walters@gmail.com>
This commit is contained in:
parent
f23d405392
commit
dce95d824a
12
docs/main.py
12
docs/main.py
@ -136,17 +136,19 @@ def define_env(env):
|
|||||||
if not os.path.exists(file_path):
|
if not os.path.exists(file_path):
|
||||||
raise FileNotFoundError(f'Source file {filename} does not exist.')
|
raise FileNotFoundError(f'Source file {filename} does not exist.')
|
||||||
|
|
||||||
repo_url = get_repo_url(raw=raw)
|
# Construct repo URL
|
||||||
|
repo_url = get_repo_url(raw=False)
|
||||||
if raw:
|
|
||||||
url = f'{repo_url}/{branch}/{filename}'
|
|
||||||
else:
|
|
||||||
url = f'{repo_url}/blob/{branch}/{filename}'
|
url = f'{repo_url}/blob/{branch}/{filename}'
|
||||||
|
|
||||||
# Check that the URL exists before returning it
|
# Check that the URL exists before returning it
|
||||||
if not check_link(url):
|
if not check_link(url):
|
||||||
raise FileNotFoundError(f'URL {url} does not exist.')
|
raise FileNotFoundError(f'URL {url} does not exist.')
|
||||||
|
|
||||||
|
if raw:
|
||||||
|
# If requesting the 'raw' URL, take this into account here...
|
||||||
|
repo_url = get_repo_url(raw=True)
|
||||||
|
url = f'{repo_url}/{branch}/{filename}'
|
||||||
|
|
||||||
return url
|
return url
|
||||||
|
|
||||||
@env.macro
|
@env.macro
|
||||||
|
Loading…
x
Reference in New Issue
Block a user