Skip to content

Commit

Permalink
Update webdav, support auto auth detection
Browse files Browse the repository at this point in the history
  • Loading branch information
perry-mitchell committed Mar 18, 2024
1 parent cc95904 commit 015fa9c
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 56 deletions.
62 changes: 13 additions & 49 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
"pify": "^6.1.0",
"url-join": "^5.0.0",
"uuid": "^9.0.1",
"webdav": "^5.3.1"
"webdav": "^5.5.0"
},
"devDependencies": {
"@babel/cli": "^7.23.4",
Expand Down
8 changes: 6 additions & 2 deletions source/datasources/WebDAVDatasource.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { WebDAVClient } from "webdav";
import { AuthType, WebDAVClient } from "webdav";
import type { createClient as createWebDAVClient } from "webdav";
import pathPosix from "path-posix";
import { TextDatasource } from "./TextDatasource.js";
import { fireInstantiationHandlers, registerDatasource } from "./register.js";
Expand Down Expand Up @@ -39,9 +40,12 @@ export default class WebDAVDatasource extends TextDatasource {
};
const { endpoint, password, path, username } = (this._config = datasourceConfig);
this._path = path;
const createClient = getSharedAppEnv().getProperty("net/webdav/v1/newClient");
const createClient = getSharedAppEnv().getProperty(
"net/webdav/v1/newClient"
) as typeof createWebDAVClient;
if (typeof username === "string" && typeof password === "string") {
this._client = createClient(endpoint, {
authType: AuthType.Auto,
username,
password,
maxBodyLength: MAX_DATA_SIZE,
Expand Down
4 changes: 2 additions & 2 deletions source/facades/tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ export function createFieldDescriptor(
valueType: valueType
? valueType
: entryPropertyType === "attribute"
? null
: getEntryPropertyValueType(entry, entryPropertyName),
? null
: getEntryPropertyValueType(entry, entryPropertyName),
formatting,
removeable
};
Expand Down
4 changes: 2 additions & 2 deletions source/io/VaultFormatA.ts
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,8 @@ export class VaultFormatA extends VaultFormat {
const type = !item.originalValue
? EntryChangeType.Created
: typeof item.newValue === "string"
? EntryChangeType.Modified
: EntryChangeType.Deleted;
? EntryChangeType.Modified
: EntryChangeType.Deleted;
const change: EntryChange = {
property: item.property,
type,
Expand Down

0 comments on commit 015fa9c

Please sign in to comment.