mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 14:02:21 -04:00
disable media get / posts when collection closed
https://forums.ankiweb.net/t/countdown-to-events-exams-addon-official-thread/1093/4?u=dae
This commit is contained in:
parent
b363aaf401
commit
440aa129d9
1 changed files with 11 additions and 0 deletions
|
@ -124,6 +124,10 @@ def allroutes(pathin):
|
|||
|
||||
try:
|
||||
if flask.request.method == "POST":
|
||||
if not aqt.mw.col:
|
||||
print(f"collection not open, ignore request for {path}")
|
||||
return flask.make_response(f"Collection not open", HTTPStatus.NOT_FOUND)
|
||||
|
||||
if path == "graphData":
|
||||
body = request.data
|
||||
data = graph_data(aqt.mw.col, **from_json_bytes(body))
|
||||
|
@ -196,6 +200,13 @@ def _redirectWebExports(path):
|
|||
if re.fullmatch(pattern, subPath):
|
||||
return addMgr.addonsFolder(), addonPath
|
||||
|
||||
print(f"couldn't locate item in add-on folder {path}")
|
||||
return None
|
||||
|
||||
if not aqt.mw.col:
|
||||
print(f"collection not open, ignore request for {path}")
|
||||
return None
|
||||
|
||||
return aqt.mw.col.media.dir(), path
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue