Commit 4f8237d7 authored by Nicolas Pernoud's avatar Nicolas Pernoud
Browse files

fix: folder renaming after create

parent 0e87febb
Pipeline #7437 passed with stages
in 2 minutes and 49 seconds
......@@ -87,6 +87,10 @@ img {
.media {
cursor: pointer;
margin-top: 0.5rem !important;
padding-top: 0.5rem !important;
margin-bottom: 0.5rem;
padding-bottom: 0.5rem;
}
.media a {
......@@ -193,4 +197,4 @@ a.navbar-item.is-active {
.modal-card-title {
font-weight: bold;
}
\ No newline at end of file
}
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -159,7 +159,7 @@ function davTemplate(dav) {
</div>
<p class="has-text-centered"><strong>${dav.name ? dav.name : dav.id}</strong></p>
<div class="card-footer">
<div class="dropdown is-hoverable">
<div class="dropdown is-hoverable" style="margin-top: 1px;">
<div class="dropdown-trigger">
<button class="button is-white">
<span class="icon is-small">
......
......@@ -25,7 +25,7 @@ export class Explorer {
<p class="modal-card-title">Explorer</p>
<button class="delete" aria-label="close" id="explorer-modal-close"></button>
</header>
<section id="explorer-modal-content" class="modal-card-body"></section>
<section id="explorer-modal-content" class="modal-card-body pt-0"></section>
<progress id="explorer-modal-progress" class="progress is-primary is-small" style="margin-bottom:0px;"></progress>
<footer id="explorer-modal-footer" class="modal-card-foot">
<div class="buttons" id="explorer-modal-footer-buttons">
......@@ -293,10 +293,11 @@ export class Explorer {
renameOK.addEventListener("click", async () => {
try {
toggleButtons();
const newName = file.isDir ? renameModal.getElementsByTagName("input")[0].value + "/" : renameModal.getElementsByTagName("input")[0].value;
const response = await fetch(this.fullHostname + file.path, {
method: "MOVE",
headers: new Headers({
Destination: this.fullHostname + path(this.path, renameModal.getElementsByTagName("input")[0].value),
Destination: this.fullHostname + path(this.path, newName),
"XSRF-Token": this.user.xsrftoken,
}),
credentials: "include",
......@@ -340,10 +341,11 @@ export class Explorer {
`;
pasteControl.getElementsByTagName("a")[0].addEventListener("click", async () => {
try {
const dest = file.isDir ? path(this.path, file.name) + "/" : path(this.path, file.name);
const response = await fetch(this.fullHostname + file.path, {
method: isCopy ? "COPY" : "MOVE",
headers: new Headers({
Destination: this.fullHostname + path(this.path, file.name),
Destination: this.fullHostname + dest,
"XSRF-Token": this.user.xsrftoken,
}),
credentials: "include",
......@@ -367,7 +369,7 @@ export class Explorer {
async newFolder() {
const newFolderName = "New Folder";
const folder = { name: newFolderName, isDir: true, type: "dir", size: 0, lastModified: new Date(), path: path(this.path, newFolderName), id: this.files.length + 1 };
const folder = { name: newFolderName, isDir: true, type: "dir", size: 0, lastModified: new Date(), path: path(this.path, newFolderName) + "/", id: this.files.length + 1 };
try {
const response = await fetch(this.fullHostname + folder.path, {
method: "MKCOL",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment