get rootpath with dav

This commit is contained in:
GMrrc 2024-11-18 15:57:53 +01:00
parent 8a34ab14d3
commit 2ac5b8e2ec
3 changed files with 8 additions and 6 deletions

View File

@ -916,6 +916,7 @@ __webpack_require__.r(__webpack_exports__);
return {
files: [],
// Liste des fichiers et dossiers récupérés
root_path: (0,_nextcloud_files_dav__WEBPACK_IMPORTED_MODULE_0__.getRootPath)(),
current_dir: '/',
breadcrumbParts: [],
isAddFilePopupVisible: false,
@ -930,7 +931,7 @@ __webpack_require__.r(__webpack_exports__);
async fetchFiles() {
try {
const client = (0,_nextcloud_files_dav__WEBPACK_IMPORTED_MODULE_0__.getClient)();
const directoryItems = await client.getDirectoryContents('/files/admin' + this.current_dir); // Remplacez "admin" par le nom de l'utilisateur courant
const directoryItems = await client.getDirectoryContents(this.root_path + this.current_dir); // Remplacez "admin" par le nom de l'utilisateur courant
this.files = directoryItems.map(file => ({
basename: file.basename,
@ -979,7 +980,7 @@ __webpack_require__.r(__webpack_exports__);
if (!this.newFileName) return;
try {
const client = (0,_nextcloud_files_dav__WEBPACK_IMPORTED_MODULE_0__.getClient)();
const filePath = `/files/admin${this.current_dir}/${this.newFileName}`;
const filePath = `${this.root_path}${this.current_dir}/${this.newFileName}`;
await client.createDirectory(filePath, '');
this.newFileName = '';
this.isAddFilePopupVisible = false;

File diff suppressed because one or more lines are too long

View File

@ -107,7 +107,7 @@
<script>
import { getClient } from '@nextcloud/files/dav';
import { getClient, getRootPath } from '@nextcloud/files/dav';
import NcBreadcrumbs from '@nextcloud/vue/dist/Components/NcBreadcrumbs.js';
import NcBreadcrumb from '@nextcloud/vue/dist/Components/NcBreadcrumb.js';
import Plus from 'vue-material-design-icons/Plus.vue'
@ -122,6 +122,7 @@ export default {
data() {
return {
files: [], // Liste des fichiers et dossiers récupérés
root_path: getRootPath(),
current_dir: '/',
breadcrumbParts: [],
isAddFilePopupVisible: false,
@ -136,7 +137,7 @@ export default {
async fetchFiles() {
try {
const client = getClient();
const directoryItems = await client.getDirectoryContents('/files/admin' + this.current_dir); // Remplacez "admin" par le nom de l'utilisateur courant
const directoryItems = await client.getDirectoryContents(this.root_path + this.current_dir); // Remplacez "admin" par le nom de l'utilisateur courant
this.files = directoryItems.map(file => ({
basename: file.basename,
@ -185,7 +186,7 @@ export default {
if (!this.newFileName) return;
try {
const client = getClient();
const filePath = `/files/admin${this.current_dir}/${this.newFileName}`;
const filePath = `${this.root_path}${this.current_dir}/${this.newFileName}`;
await client.createDirectory(filePath, '');
this.newFileName = '';
this.isAddFilePopupVisible = false;