diff --git a/src/assets/index.js b/src/assets/index.js
index 9bf35a3..0a69c0e 100644
--- a/src/assets/index.js
+++ b/src/assets/index.js
@@ -27,7 +27,6 @@ class Uploader {
const ajax = new XMLHttpRequest();
ajax.upload.addEventListener("progress", e => this.progress(e), false);
ajax.addEventListener("readystatechange", () => {
- console.log(ajax.readyState, ajax.status)
if(ajax.readyState === 4) {
if (ajax.status == 200) {
this.complete();
diff --git a/src/server.rs b/src/server.rs
index a317fb2..dba3564 100644
--- a/src/server.rs
+++ b/src/server.rs
@@ -11,7 +11,8 @@ use headers::{
HeaderMap, HeaderMapExt, IfModifiedSince, IfNoneMatch, IfRange, LastModified, Range,
};
use hyper::header::{
- HeaderValue, ACCEPT, CONTENT_DISPOSITION, CONTENT_TYPE, ORIGIN, RANGE, WWW_AUTHENTICATE,
+ HeaderValue, ACCEPT, AUTHORIZATION, CONTENT_DISPOSITION, CONTENT_TYPE, ORIGIN, RANGE,
+ WWW_AUTHENTICATE,
};
use hyper::service::{make_service_fn, service_fn};
use hyper::{Body, Method, StatusCode};
@@ -193,8 +194,8 @@ impl InnerService {
io::copy(&mut body_reader, &mut file).await?;
- let req_query = req.uri().query().unwrap_or_default();
- if req_query == "unzip" {
+ let query = req.uri().query().unwrap_or_default();
+ if query == "unzip" {
let root = path.parent().unwrap();
let mut zip = ZipFileReader::new(File::open(&path).await?).await?;
for i in 0..zip.entries().len() {
@@ -204,6 +205,9 @@ impl InnerService {
if entry_name.ends_with('/') {
fs::create_dir_all(entry_path).await?;
} else {
+ if !self.args.allow_delete && fs::metadata(&entry_path).await.is_ok() {
+ continue;
+ }
if let Some(parent) = entry_path.parent() {
if fs::symlink_metadata(parent).await.is_err() {
fs::create_dir_all(&parent).await?;
@@ -395,7 +399,7 @@ impl InnerService {
let pass = {
match &self.args.auth {
None => true,
- Some(auth) => match req.headers().get("Authorization") {
+ Some(auth) => match req.headers().get(AUTHORIZATION) {
Some(value) => match value.to_str().ok().map(|v| {
let mut it = v.split(' ');
(it.next(), it.next())