-
- {
- const newPathArr = path.split('/');
- newPathArr.pop();
- let newPath = newPathArr.join('/');
- if (newPath == '') newPath = '/';
- setPath(newPath);
- }}
- >
-
-
-
- {
- e.target.value && setPath(e.target.value);
- }}
- style={{ height: '100%' }}
- />
-
-
-
- {loading && }
- {!loading &&
- listing.files
- .filter((file) => (includeFiles || file.isdir) && (!regex || regex.test(file.name)))
- .map((file) => {
- let extension = file.realpath.split('.').pop() as string;
- return (
- {
- const fullPath = `${path}${path.endsWith('/') ? '' : '/'}${file.name}`;
- if (file.isdir) setPath(fullPath);
- else {
- onSubmit({ path: fullPath, realpath: file.realpath });
- closeModal?.();
- }
- }}
- >
-
- {file.isdir ? (
-
- ) : (
-
- {file.realpath.includes('.') ? (
-
- ) : (
-
- )}
-
- )}
-
+
+
+
+ {
+ const newPathArr = path.split('/');
+ const lastPath = newPathArr.pop();
+ //If I have a single / with spaces, pop the array twice
+ if (lastPath?.match(/^\/\s*$/) != null) newPathArr.pop();
+ let newPath = newPathArr.join('/');
+ if (newPath == '') newPath = '/';
+ setPath(newPath);
+ }}
+ >
+
+
+
+ {
+ e.target.value && setPath(e.target.value);
+ }}
+ style={{ height: '100%' }}
+ />
+
+
+
+ setShowHidden((x) => !x)}
+ />
+ setSort(x.data)} />
+ {validFileExtensions && (
+
+ )}
+
+
+
+
+ {loading && error === FileErrorTypes.None && }
+ {!loading &&
+ error === FileErrorTypes.None &&
+ files.map((file) => {
+ const extension = file.realpath.split('.').pop() as string;
+ return (
+ {
+ const fullPath = `${path}${path.endsWith('/') ? '' : '/'}${file.name}`;
+ if (file.isdir) setPath(fullPath);
+ else {
+ onSubmit({ path: fullPath, realpath: file.realpath });
+ closeModal?.();
+ }
+ }}
+ >
+
+ {file.isdir ? (
+
+ ) : (
+
+ {file.realpath.includes('.') ? (
+
+ ) : (
+
+ )}
+
+ )}
+
+
+
- {file.name}
-
-
-
- );
- })}
- {error}
-
+ {file.isdir ? t('FilePickerIndex.folder.label') : filesize(file.size, { standard: 'iec' })}
+ {new Date(file.modified * 1000).toLocaleString()}
+
+
+ );
+ })}
+ {error !== FileErrorTypes.None && }
+
+
+
{!loading && !error && !includeFiles && (
-
{
- onSubmit({ path, realpath: listing.realpath });
- closeModal?.();
- }}
- >
- {t('FilePickerIndex.folder.select')}
-
+
+ {
+ onSubmit({ path, realpath: listing.realpath });
+ closeModal?.();
+ }}
+ >
+ {t('FilePickerIndex.folder.select')}
+
+
)}
-
+ {page * max < listing.total && (
+