Clip off ".json" from story name when downloading
This commit is contained in:
parent
7e1b1add11
commit
24d57a7ac3
10
aiserver.py
10
aiserver.py
|
@ -507,7 +507,10 @@ def download():
|
||||||
if(save_format == "plaintext"):
|
if(save_format == "plaintext"):
|
||||||
txt = vars.prompt + "".join(vars.actions.values())
|
txt = vars.prompt + "".join(vars.actions.values())
|
||||||
save = Response(txt)
|
save = Response(txt)
|
||||||
save.headers.set('Content-Disposition', 'attachment', filename='%s.txt' % path.basename(vars.savedir))
|
filename = path.basename(vars.savedir)
|
||||||
|
if filename[-5:] == ".json":
|
||||||
|
filename = filename[:-5]
|
||||||
|
save.headers.set('Content-Disposition', 'attachment', filename='%s.txt' % filename)
|
||||||
return(save)
|
return(save)
|
||||||
|
|
||||||
# Build json to write
|
# Build json to write
|
||||||
|
@ -531,7 +534,10 @@ def download():
|
||||||
})
|
})
|
||||||
|
|
||||||
save = Response(json.dumps(js, indent=3))
|
save = Response(json.dumps(js, indent=3))
|
||||||
save.headers.set('Content-Disposition', 'attachment', filename='%s.json' % path.basename(vars.savedir))
|
filename = path.basename(vars.savedir)
|
||||||
|
if filename[-5:] == ".json":
|
||||||
|
filename = filename[:-5]
|
||||||
|
save.headers.set('Content-Disposition', 'attachment', filename='%s.json' % filename)
|
||||||
return(save)
|
return(save)
|
||||||
|
|
||||||
#============================ METHODS =============================#
|
#============================ METHODS =============================#
|
||||||
|
|
Loading…
Reference in New Issue