basically workable webdav

This commit is contained in:
fyears
2021-11-21 15:33:14 +08:00
parent ce0cc232c8
commit d1839706af
9 changed files with 521 additions and 192 deletions
+14 -2
View File
@@ -4,8 +4,6 @@ import * as path from "path";
import { base32 } from "rfc4648";
import XRegExp from "xregexp";
export type SUPPORTED_SERVICES_TYPE = "s3" | "webdav" | "ftp";
/**
* If any part of the file starts with '.' or '_' then it's a hidden file.
* @param item
@@ -130,3 +128,17 @@ export const isVaildText = (a: string) => {
a
);
};
/**
* If input is already a folder, returns it as is;
* And if input is a file, returns its direname.
* @param a
* @returns
*/
export const getPathFolder = (a: string) => {
if (a.endsWith("/")) {
return a;
}
const b = path.posix.dirname(a);
return b.endsWith("/") ? b : `${b}/`;
};