0.5.2: Change retrieve_file error code to 403 because 404 doesn't work for some reason lol
This commit is contained in:
parent
839bd717b3
commit
873b4a4f5a
2 changed files with 15 additions and 3 deletions
15
README.md
15
README.md
|
@ -3,8 +3,21 @@
|
||||||
Simple file uploader made on Crystal.
|
Simple file uploader made on Crystal.
|
||||||
I'm making this to replace my current File uploader hosted on https://ayaya.beauty which uses https://github.com/nokonoko/uguu
|
I'm making this to replace my current File uploader hosted on https://ayaya.beauty which uses https://github.com/nokonoko/uguu
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
- Temporary file file uploader like Uguu
|
||||||
|
- File deletion link (not available in frontend for now)
|
||||||
|
- Chatterino and ShareX support
|
||||||
|
- Low memory usage: Between 6MB at idle and 25MB if a file is being uploaded of retrieved. I will depend of your traffic.
|
||||||
|
|
||||||
## TODO
|
## TODO
|
||||||
|
|
||||||
- ~~Add file size limit~~ ADDED
|
- ~~Add file size limit~~ ADDED
|
||||||
- Fix error when accessing `http://127.0.0.1:8080` with an empty DB.
|
- Fix error when accessing `http://127.0.0.1:8080` with an empty DB.
|
||||||
- Better frontend...
|
- Better frontend...
|
||||||
|
- Disable file deletion if `delete_files_after_check_seconds` or `delete_files_after` is set to `0`
|
||||||
|
- Disable delete key if `delete_key_lenght` is `0`
|
||||||
|
- Exit if `filename_lenght` is `0`
|
||||||
|
- Disable file limit if `size_limit` is `0`
|
||||||
|
-
|
||||||
|
|
||||||
|
|
|
@ -100,13 +100,12 @@ end
|
||||||
end
|
end
|
||||||
|
|
||||||
def retrieve_file(env)
|
def retrieve_file(env)
|
||||||
puts env.params.url
|
|
||||||
begin
|
begin
|
||||||
filename = SQL.query_one "SELECT filename FROM files WHERE filename = ?", env.params.url["filename"].to_s.split(".").first, as: String
|
filename = SQL.query_one "SELECT filename FROM files WHERE filename = ?", env.params.url["filename"].to_s.split(".").first, as: String
|
||||||
extension = SQL.query_one "SELECT extension FROM files WHERE filename = ?", filename, as: String
|
extension = SQL.query_one "SELECT extension FROM files WHERE filename = ?", filename, as: String
|
||||||
send_file env, "#{CONFIG.files}/#{filename}#{extension}"
|
send_file env, "#{CONFIG.files}/#{filename}#{extension}"
|
||||||
rescue
|
rescue
|
||||||
error404("This file does not exist")
|
error403("This file does not exist")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue