Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Favicon stack trace #8

Closed
gaelL opened this issue Nov 2, 2015 · 5 comments
Closed

Favicon stack trace #8

gaelL opened this issue Nov 2, 2015 · 5 comments

Comments

@gaelL
Copy link
Collaborator

gaelL commented Nov 2, 2015

When you are using explorer like chrome, chrome automatically try to get favicon.ico.

127.0.0.1 - - [02/Nov/2015 22:43:28] "GET /favicon.ico HTTP/1.1" 500 -
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1836, in __call__
    return self.wsgi_app(environ, start_response)
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1820, in wsgi_app
    response = self.make_response(self.handle_exception(e))
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1403, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1817, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1478, in full_dispatch_request
    response = self.make_response(rv)
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1566, in make_response
    raise ValueError('View function did not return a response')
ValueError: View function did not return a response
@guits
Copy link
Owner

guits commented Nov 3, 2015

Do you think we should fix it by ignoring all query "GET /favicon.ico" or simply by providing the file ?

@gaelL
Copy link
Collaborator Author

gaelL commented Nov 3, 2015

Hum, start to ignore (CF #5 issue).

@guits
Copy link
Owner

guits commented Nov 5, 2015

in fact, every query that are not handled by the application cause the server to return a 500 error instead of a 404 error

@guits
Copy link
Owner

guits commented Nov 5, 2015

12:11:22 ✔ guits@elisheba:~$ curl -o/dev/null -D- -s -XGET http://pastefile.fr/foo
HTTP/1.1 500 INTERNAL SERVER ERROR
Server: nginx
Date: Thu, 05 Nov 2015 11:12:00 GMT
Content-Type: text/html
Content-Length: 291
Connection: keep-alive

12:11:27 ✔ guits@elisheba:~$ curl -o/dev/null -D- -s -XGET http://pastefile.fr/foo/
HTTP/1.1 404 NOT FOUND
Server: nginx
Date: Thu, 05 Nov 2015 11:12:02 GMT
Content-Type: text/html
Content-Length: 233
Connection: keep-alive

12:11:29 ✔ guits@elisheba:~$ curl -o/dev/null -D- -s -XGET http://pastefile.fr/foo/bar
HTTP/1.1 404 NOT FOUND
Server: nginx
Date: Thu, 05 Nov 2015 11:12:07 GMT
Content-Type: text/html
Content-Length: 233
Connection: keep-alive

12:11:34 ✔ guits@elisheba:~$

guits added a commit that referenced this issue Nov 6, 2015
@guits
Copy link
Owner

guits commented Nov 6, 2015

fixed in b522173

 @app.route('/<id_file>', methods=['GET'])
 def get_file(id_file):
     with JsonDB(app.config['file_list']) as db:
-        filename = db.db[id_file]['storage_full_filename']
-        print filename
-        return send_from_directory(app.config['upload_folder'],
-                                   os.path.basename(filename))
+        if id_file in db.db:
+            filename = db.db[id_file]['storage_full_filename']
+            return send_from_directory(app.config['upload_folder'],
+                                       os.path.basename(filename))
+        else:
+            return abort(404)```

@guits guits closed this as completed Nov 6, 2015
@guits guits mentioned this issue Nov 6, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants