Giter VIP home page Giter VIP logo

Comments (5)

guits avatar guits commented on August 30, 2024

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

from pastefile.

gaelL avatar gaelL commented on August 30, 2024

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

from pastefile.

guits avatar guits commented on August 30, 2024

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

from pastefile.

guits avatar guits commented on August 30, 2024

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:~$

from pastefile.

guits avatar guits commented on August 30, 2024

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)```

from pastefile.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.