From 70fea6c6b64bf82ffed3dd380fb3e140bd05be20 Mon Sep 17 00:00:00 2001 From: Desmond Date: Mon, 27 May 2024 14:46:26 +0800 Subject: [PATCH] fix: delete file request --- src/interface/emacs/khoj.el | 2 +- src/interface/emacs/tests/khoj-tests.el | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/interface/emacs/khoj.el b/src/interface/emacs/khoj.el index 392d581e..1a9f7efd 100644 --- a/src/interface/emacs/khoj.el +++ b/src/interface/emacs/khoj.el @@ -491,7 +491,7 @@ Use `BOUNDARY' to separate files. This is sent to Khoj server as a POST request. (file-name (encode-coding-string file-to-index 'utf-8))) (insert (format "--%s\r\n" boundary)) (insert (format "Content-Disposition: form-data; name=\"files\"; filename=\"%s\"\r\n" file-name)) - (insert "Content-Type: %s\r\n\r\n" content-type) + (insert (format "Content-Type: %s\r\n\r\n" content-type)) (insert "") (insert "\r\n"))) (insert (format "--%s--\r\n" boundary)) diff --git a/src/interface/emacs/tests/khoj-tests.el b/src/interface/emacs/tests/khoj-tests.el index 4df5f348..cd2a1f02 100644 --- a/src/interface/emacs/tests/khoj-tests.el +++ b/src/interface/emacs/tests/khoj-tests.el @@ -244,19 +244,16 @@ Rule everything\n\n\r\n\ (progn (should (equal - (khoj--render-update-files-as-request-body (list upgrade-file act-file "/tmp/deleted-file.org") "khoj") + (khoj--render-delete-files-as-request-body (list upgrade-file act-file "/tmp/deleted-file.org") "khoj") (format "\n--khoj\r\n\ Content-Disposition: form-data; name=\"files\"; filename=\"%s\"\r\n\ Content-Type: text/org\r\n\r\n\ -# Become God\n\ -## Upgrade\n\n\ -Penance to Immortality\n\n\r +\r --khoj\r\n\ Content-Disposition: form-data; name=\"files\"; filename=\"%s\"\r\n\ Content-Type: text/org\r\n\r\n\ -## Act\n\n\ -Rule everything\n\n\r +\r --khoj\r\n\ Content-Disposition: form-data; name=\"files\"; filename=\"%s\"\r\n\ Content-Type: text/org\r\n\r\n\