Giter VIP home page Giter VIP logo

pastefile's Issues

Can't opened DMG files

Hi,

When I tried to open a DMG file sent by Pastefile, it's opened a text editor with binary code inside instead of the DiskImageMounter app.

Discussion about an admin_token

Idea is to provide a "admin_token" in the config file.
Request with the admin_token in the header could have more option than an other user.

For example, we could add in the config file, list of method only for admin :
admin_only_urls : ls,delete, ...

bad filename when retrieving a file

the filename is not the good one when retrieving a file.
this is because files are stored with md5 as filename

line 108: os.rename(tmp_full_filename, storage_full_filename)

need to find a way to send file with original filename

Feature : allow to enable or disable /ls url

For security reason or custom usage, it could be cool to provide a way to disable /ls option.

For a usage like a pastebin where only user with the link can access to the file.

Feature : Burn after read url

Provide the possibility to upload a burn after read file.

To allow only one user to download the file. After the download the file will be removed.

Clean 404.html template

We have

curl localhost:5000/dfgdfg

  <h1>File not found</h1>
  <p>Usage:<br><br>
GET /ls<br>
GET /id_file/infos<br>
POST /<br>
GET /<id_file><br>
<br><br>
TO improve

We should fix to display help like the / url

Default value for config

If a variable isn't present on config file, application crash.

Typical case :
Upgrade, doesn't compare your config file to template.
If a new config variable has been added, server will crash.

Add default view.

When we try a random url we have an error :

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

Try to add a custom 404 page that print of a help page.

Add send by email button

It could be great to add a button 'upload and send by email'
Thus we could directly upload the file and the mail client would open automatically to send the link.

Add a logger

add log in file to know who and when a file is uploaded.

Split app.py into smaller files

I proposed :

Also rename some method to a more explicite name : https://github.com/guits/pastefile/blob/master/pastefile/app.py#L224-L229

For exemple :

get_or_delete_file_view
    delete_file()
    get_file()

If you are ok with that, I propose to implement that, just give me a GO when it should not impact code that you havn't merged yet

Change the behavior when the file already exist

Actually :

~$ curl -F "file=@foo" pastefile.learnit.fr
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>403 Forbidden</title>
<h1>Forbidden</h1>
<p>You don't have the permission to access the requested resource. It is either read-protected or not readable by the server.</p>

Should be better to only return the url of the existing file.

Favicon stack trace

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

Check directory in config.

Check and create if possible directory in config file.
Example if the upload_folder not exist, you have a python error

Add tests on the code

If possible add unit test or at least a simple functional test.

For functional tests it could be in python or not.

The idea is to test the app with a customer point of view :

  • Launch the app
  • Curl help / status and verify the status code and output.
  • Upload / delete / download an object.
  • Curl wrong url and verify the status code and output.

Display file in browser

Currently each url result in a file downloaded by you browser.

We should give a try to use mime type to fill the content type header.

The goal is to display text or image in your browser natively.

Dockerize

Add a Dockerfile to build a docker image

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.