summaryrefslogtreecommitdiff
path: root/www/cadaver/files/patch-src-commands.c
diff options
context:
space:
mode:
Diffstat (limited to 'www/cadaver/files/patch-src-commands.c')
-rw-r--r--www/cadaver/files/patch-src-commands.c96
1 files changed, 42 insertions, 54 deletions
diff --git a/www/cadaver/files/patch-src-commands.c b/www/cadaver/files/patch-src-commands.c
index cf0096160ac9..1d718bef3899 100644
--- a/www/cadaver/files/patch-src-commands.c
+++ b/www/cadaver/files/patch-src-commands.c
@@ -1,6 +1,6 @@
---- src/commands.c.orig 2022-10-30 10:46:52 UTC
+--- src/commands.c.orig 2025-05-02 18:23:47 UTC
+++ src/commands.c
-@@ -70,8 +70,7 @@
+@@ -74,8 +74,7 @@
#include <ne_dates.h>
#include "i18n.h"
@@ -10,57 +10,45 @@
#include "cadaver.h"
#include "commands.h"
#include "options.h"
-@@ -771,17 +770,17 @@ static char *clever_path(const char *p, const char *sr
- dest_is_coll = (dest[strlen(dest)-1] == '/');
- src_is_coll = (src[strlen(src)-1] == '/');
- if (strcmp(dest, ".") == 0) {
-- ret = resolve_path(p, base_name(src), false);
-+ ret = resolve_path(p, basename(src), false);
- } else if (strcmp(dest, "..") == 0) {
- char *parent;
- parent = ne_path_parent(p);
-- ret = resolve_path(parent, base_name(src), false);
-+ ret = resolve_path(parent, basename(src), false);
- free(parent);
- } else if (!src_is_coll && dest_is_coll) {
- /* Moving a file to a collection... the destination should
- * be the basename of file concated with the collection. */
- char *tmp = resolve_path(p, dest, true);
-- char *enc = escape_path(base_name(src));
-+ char *enc = escape_path(basename(src));
- ret = ne_concat(tmp, enc, NULL);
- free(enc);
- free(tmp);
-@@ -979,7 +978,7 @@ static void execute_get(const char *remote, const char
- if (local == NULL) {
- struct stat st;
- /* Choose an appropriate local filename */
-- if (stat(base_name(remote), &st) == 0) {
-+ if (stat(basename(remote), &st) == 0) {
- char buf[BUFSIZ];
- /* File already exists... don't overwrite */
- snprintf(buf, BUFSIZ, _("Enter local filename for `%s': "),
-@@ -992,7 +991,7 @@ static void execute_get(const char *remote, const char
- return;
- }
- } else {
-- filename = ne_strdup(base_name(remote));
-+ filename = ne_strdup(basename(remote));
- }
- } else {
- filename = ne_strdup(local);
-@@ -1035,7 +1034,7 @@ static void execute_put(const char *local, const char
+@@ -956,7 +955,7 @@ static void do_copymove(int argc, const char *argv[],
+ else if (dest_is_coll && src_is_coll) {
+ /* Case 1. */
+ char *tmp = ne_strndup(ops[n].src, strlen(ops[n].src)-1);
+- ops[n].dest = ne_concat(uri_dest, base_name(tmp), NULL);
++ ops[n].dest = ne_concat(uri_dest, basename(tmp), NULL);
+ ne_free(tmp);
+ }
+ else if (src_is_coll && !dest_is_coll) {
+@@ -966,7 +965,7 @@ static void do_copymove(int argc, const char *argv[],
+ }
+ else if (dest_is_coll) {
+ /* Case 2. */
+- ops[n].dest = ne_concat(uri_dest, base_name(ops[n].src), NULL);
++ ops[n].dest = ne_concat(uri_dest, basename(ops[n].src), NULL);
+ }
+ else {
+ /* Case 3. */
+@@ -1030,7 +1029,7 @@ static void execute_get(const char *native_remote, con
+ else {
+ struct stat st;
+
+- filename = ne_strdup(base_name(native_remote));
++ filename = ne_strdup(basename(native_remote));
+
+ /* Choose an appropriate local filename */
+ if (stat(filename, &st) == 0) {
+@@ -1084,7 +1083,7 @@ static void execute_put(const char *local, const char
+
+ static void execute_put(const char *local, const char *remote)
{
- char *real_remote;
- if (remote == NULL) {
-- real_remote = resolve_path(session.uri.path, base_name(local), false);
-+ real_remote = resolve_path(session.uri.path, basename(local), false);
- } else {
- real_remote = resolve_path(session.uri.path, remote, false);
- }
---- src/edit.c.orig 2022-10-30 10:46:52 UTC
+- char *uri_path = uri_resolve_native(remote ? remote : base_name(local));
++ char *uri_path = uri_resolve_native(remote ? remote : basename(local));
+ simple_put(local, uri_path);
+ free(uri_path);
+ }
+--- src/edit.c.orig 2025-05-02 18:26:58 UTC
+++ src/edit.c
-@@ -116,7 +116,7 @@ void execute_edit(const char *remote)
+@@ -116,7 +116,7 @@ void execute_edit(const char *native_path)
struct ne_lock *lock = NULL;
char fname[PATH_MAX] = "/tmp/cadaver-edit-XXXXXX";
const char *pnt;
@@ -68,10 +56,10 @@
+ int fd, sufx_len;
int is_checkout, is_checkin;
- real_remote = resolve_path(session.uri.path, remote, false);
-@@ -140,9 +140,11 @@ void execute_edit(const char *remote)
+ uri_path = uri_resolve_native(native_path);
+@@ -140,9 +140,11 @@ void execute_edit(const char *native_path)
if (pnt != NULL && strchr(pnt, '/') == NULL) {
- strncat(fname, pnt, PATH_MAX);
+ strncat(fname, pnt, PATH_MAX-1);
fname[PATH_MAX-1] = '\0';
- }
+ sufx_len = strlen(pnt);