use unsafe file names
because who the fuck cares its for shitposting anyway Signed-off-by: Amneesh Singh <natto@weirdnatto.in>
This commit is contained in:
3
README
3
README
@@ -1 +1,4 @@
|
|||||||
even simpler filehost for personal use
|
even simpler filehost for personal use
|
||||||
|
|
||||||
|
to increase the upload size limit use something like
|
||||||
|
ROCKET_LIMITS='{file="50MiB",data-form="50MiB"}'
|
||||||
|
15
src/main.rs
15
src/main.rs
@@ -24,19 +24,12 @@ async fn post_file(mut upload: Form<Upload<'_>>) -> status::Custom<String> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(name) = upload.file.name() {
|
if let Some(name) = upload.file.raw_name() {
|
||||||
let extension = upload
|
|
||||||
.file
|
|
||||||
.content_type()
|
|
||||||
.unwrap()
|
|
||||||
.extension()
|
|
||||||
.unwrap_or("file".into());
|
|
||||||
|
|
||||||
let new_name = format!(
|
let new_name = format!(
|
||||||
"{}-{}.{}",
|
"{}-{}",
|
||||||
Alphanumeric.sample_string(&mut thread_rng(), 4),
|
Alphanumeric.sample_string(&mut thread_rng(), 4),
|
||||||
name,
|
name.dangerous_unsafe_unsanitized_raw()
|
||||||
extension
|
|
||||||
);
|
);
|
||||||
|
|
||||||
let uploaded = upload
|
let uploaded = upload
|
||||||
@@ -71,7 +64,7 @@ fn index() -> String {
|
|||||||
"Use curl to upload:\n\
|
"Use curl to upload:\n\
|
||||||
curl -F file=@\"[file]\" {url}\n\
|
curl -F file=@\"[file]\" {url}\n\
|
||||||
If key is enabled then a field \"key\" might be required in which case it would be\n\
|
If key is enabled then a field \"key\" might be required in which case it would be\n\
|
||||||
curl -F file=@\"[file]\" --F \"key=[key]\" {url}",
|
curl -F file=@\"[file]\" -F \"key=[key]\" {url}",
|
||||||
url = env_user_url()
|
url = env_user_url()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user