Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/endpoints/create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,13 +175,13 @@ pub async fn create(
"burn_after" => {
while let Some(chunk) = field.try_next().await? {
new_pasta.burn_after_reads = match std::str::from_utf8(&chunk).unwrap() {
// give an extra read because the user will be
// give two extra each time just because the user will be
// redirected to the pasta page automatically
"1" => 2,
"10" => 10,
"100" => 100,
"1000" => 1000,
"10000" => 10000,
"10" => 11,
"100" => 101,
"1000" => 1001,
"10000" => 10001,
"0" => 0,
_ => {
log::error!("{}", "Unexpected burn after value!");
Expand Down Expand Up @@ -332,7 +332,7 @@ pub async fn create(
} else {
Ok(HttpResponse::Found()
.append_header((
"Location",
"pasta_url",
format!("{}/upload/{}", ARGS.public_path_as_str(), slug),
))
.finish())
Expand Down
2 changes: 1 addition & 1 deletion templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@
xhr.onreadystatechange = function () {
if (xhr.readyState === XMLHttpRequest.DONE) {
if (xhr.status === 200 || xhr.status === 302) {
window.location.href = xhr.responseURL;
window.location.href = xhr.getResponseHeader('pasta_url');
} else {
console.log('Request failed with status:', xhr.status);
}
Expand Down
Loading