>
@@ -103,7 +103,7 @@ export const SidebarPanelDetails = ({ files, path, selected, setSelected, showHi
useEffect(() => {
if (selected.length === 1) {
- const filePath = path.join("/") + "/" + selected[0]?.name;
+ const filePath = path + selected[0]?.name;
cockpit.spawn(["file", "--brief", filePath], { superuser: "try", err: "message" })
.then(res => setInfo(res?.trim()))
@@ -112,7 +112,7 @@ export const SidebarPanelDetails = ({ files, path, selected, setSelected, showHi
}, [path, selected]);
const dialogs = useDialogs();
- const directory_name = path[path.length - 1];
+ const directory_name = basename(path);
const hidden_count = files.filter(file => file.name.startsWith(".")).length;
let shown_items = cockpit.format(cockpit.ngettext("$0 item", "$0 items", files.length), files.length);
if (!showHidden)
diff --git a/src/upload-button.tsx b/src/upload-button.tsx
index c61971908..391e2f0fd 100644
--- a/src/upload-button.tsx
+++ b/src/upload-button.tsx
@@ -55,7 +55,7 @@ const FileConflictDialog = ({
isMultiUpload,
dialogResult
}: {
- path: string[];
+ path: string;
file: FileInfo,
uploadFile: File,
isMultiUpload: boolean,
@@ -96,7 +96,7 @@ const FileConflictDialog = ({
{cockpit.format(
_("A file with the same name already exists in \"$0\". Replacing it will overwrite its content."),
- path.join('/')
+ path
)}
{
const ref = useRef(null);
const { addAlert, cwdInfo } = useFilesContext();
@@ -209,9 +209,7 @@ export const UploadButton = ({
const cancelledUploads = [];
await Promise.allSettled(toUploadFiles.map(async (file: File) => {
- const tmp_path = path.slice();
- tmp_path.push(file.name);
- const destination = tmp_path.join('/');
+ const destination = path + file.name;
const abort = new AbortController();
setUploadedFiles(oldFiles => {
diff --git a/test/check-application b/test/check-application
index 2ce17b115..3ff70a309 100755
--- a/test/check-application
+++ b/test/check-application
@@ -348,7 +348,7 @@ class TestFiles(testlib.MachineCase):
# Via escape
b.click(edit_button)
- b.wait_val(path_input, "/home")
+ b.wait_val(path_input, "/home/")
b.set_input_text(path_input, "/home/admin")
b.wait_visible(path_input)
b.focus(path_input)
@@ -358,7 +358,7 @@ class TestFiles(testlib.MachineCase):
# Via cancel button
b.click(edit_button)
# Cancelled edit should not save the path
- b.wait_val(path_input, "/home")
+ b.wait_val(path_input, "/home/")
b.click(cancel_button)
b.wait_not_present(path_input)
@@ -384,7 +384,7 @@ class TestFiles(testlib.MachineCase):
b.wait_not_present(path_input)
b.click(edit_button)
b.wait_visible(path_input)
- b.wait_val(path_input, "/var")
+ b.wait_val(path_input, "/var/")
b.click(cancel_button)
# Editing / shows / in the input