rspec/rules/S2083/python/rule.adoc

41 lines
753 B
Plaintext

include::../description.adoc[]
== Noncompliant Code Example
----
from flask import request, send_file
@app.route('/download')
def download():
file = request.args['file']
return send_file("static/%s" % file, as_attachment=True) # Noncompliant
----
== Compliant Solution
----
from flask import request, send_from_directory
@app.route('/download')
def download():
file = request.args['file']
return send_from_directory('static', file) # Compliant
----
include::../see.adoc[]
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::../message.adoc[]
'''
== Comments And Links
(visible only on this page)
include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]