Fix txt content type

This commit is contained in:
Dylan 2023-07-29 20:27:05 +01:00
parent b78d18545f
commit a6bea077bc

View File

@ -93,7 +93,7 @@ def twitfix(sub_path):
if e is not None:
return abort(500,"Failed to scan tweet: "+e)
return abort(500,"Failed to scan tweet")
return make_cached_vnf_response(vnf,getTemplate("txt.html",vnf,vnf["description"],"",clean,"","","",""))
return make_content_type_response(getTemplate("txt.html",vnf,vnf["description"],"",clean,"","","",""),"text/plain")
elif request.url.startswith("https://d.vx"): # Matches d.fx? Try to give the user a direct link
if isValidUserAgent(user_agent):
twitter_url = config['config']['url'] + "/"+sub_path
@ -306,6 +306,11 @@ def secondsUntilTTL(ttl):
untilTTL = ttl - datetime.today().replace(microsecond=0)
return untilTTL.total_seconds()
def make_content_type_response(response, content_type):
resp = make_response(response)
resp.headers['Content-Type'] = content_type
return resp
def make_cached_vnf_response(vnf,response):
return response
try: