mirror of
https://github.com/9001/copyparty.git
synced 2025-09-30 13:42:27 -06:00
overwrite on upload with header "replace"
This commit is contained in:
parent
9f46e4dbd7
commit
397ed5653b
|
@ -2301,7 +2301,11 @@ class HttpCli(object):
|
|||
|
||||
if (
|
||||
self.can_delete
|
||||
and (vfs.flags.get("daw") or "x-oc-mtime" in self.headers)
|
||||
and (
|
||||
vfs.flags.get("daw")
|
||||
or "replace" in self.headers
|
||||
or "x-oc-mtime" in self.headers
|
||||
)
|
||||
) or (
|
||||
not bos.path.exists(os.path.join(fdir, tnam))
|
||||
and not bos.path.getsize(path)
|
||||
|
@ -3344,7 +3348,7 @@ class HttpCli(object):
|
|||
|
||||
open_args = {"fdir": fdir, "suffix": suffix, "vf": vfs.flags}
|
||||
|
||||
if "replace" in self.uparam:
|
||||
if "replace" in self.uparam or "replace" in self.headers:
|
||||
if not self.can_delete:
|
||||
self.log("user not allowed to overwrite with ?replace")
|
||||
elif bos.path.exists(abspath):
|
||||
|
|
|
@ -246,6 +246,7 @@ upload modifiers:
|
|||
| `Accept: json` | `want=json` | return upload info as json; same as `?j` |
|
||||
| `Rand: 4` | `rand=4` | generate random filename with 4 characters |
|
||||
| `Life: 30` | `life=30` | delete file after 30 seconds |
|
||||
| `Replace: 1` | `replace` | overwrite file if exists |
|
||||
| `CK: no` | `ck` | disable serverside checksum (maybe faster) |
|
||||
| `CK: md5` | `ck=md5` | return md5 checksum instead of sha512 |
|
||||
| `CK: sha1` | `ck=sha1` | return sha1 checksum |
|
||||
|
@ -254,7 +255,9 @@ upload modifiers:
|
|||
| `CK: b2s` | `ck=b2s` | return blake2s checksum |
|
||||
|
||||
* `life` only has an effect if the volume has a lifetime, and the volume lifetime must be greater than the file's
|
||||
|
||||
* `replace` upload-modifier:
|
||||
* the header `replace: 1` works for both PUT and multipart-post
|
||||
* the url-param `replace` only works for multipart-post
|
||||
* server behavior of `msg` can be reconfigured with `--urlform`
|
||||
|
||||
## admin
|
||||
|
|
Loading…
Reference in a new issue