encode username
This commit is contained in:
parent
85aed7cfb9
commit
871e8dc3cf
@ -209,6 +209,13 @@ const tryEncodeURI = (x: string) => {
|
|||||||
return encodeURI(x);
|
return encodeURI(x);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const tryEncodeUsernamePassword = (x: string) => {
|
||||||
|
if (onlyAscii(x)) {
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
return unescape(encodeURIComponent(x));
|
||||||
|
};
|
||||||
|
|
||||||
const parseCustomHeaders = (x: string): Record<string, string> => {
|
const parseCustomHeaders = (x: string): Record<string, string> => {
|
||||||
const y = x.trim();
|
const y = x.trim();
|
||||||
if (y === "") {
|
if (y === "") {
|
||||||
@ -281,15 +288,17 @@ export class FakeFsWebdav extends FakeFs {
|
|||||||
this.webdavConfig.username !== "" &&
|
this.webdavConfig.username !== "" &&
|
||||||
this.webdavConfig.password !== ""
|
this.webdavConfig.password !== ""
|
||||||
) {
|
) {
|
||||||
|
console.debug("hey!");
|
||||||
this.client = createClient(this.webdavConfig.address, {
|
this.client = createClient(this.webdavConfig.address, {
|
||||||
username: this.webdavConfig.username,
|
username: tryEncodeUsernamePassword(this.webdavConfig.username),
|
||||||
password: this.webdavConfig.password,
|
password: tryEncodeUsernamePassword(this.webdavConfig.password),
|
||||||
headers: headers,
|
headers: headers,
|
||||||
authType:
|
authType:
|
||||||
this.webdavConfig.authType === "digest"
|
this.webdavConfig.authType === "digest"
|
||||||
? AuthType.Digest
|
? AuthType.Digest
|
||||||
: AuthType.Password,
|
: AuthType.Password,
|
||||||
});
|
});
|
||||||
|
console.debug("fuck!");
|
||||||
} else {
|
} else {
|
||||||
console.info("no password");
|
console.info("no password");
|
||||||
this.client = createClient(this.webdavConfig.address, {
|
this.client = createClient(this.webdavConfig.address, {
|
||||||
@ -678,8 +687,8 @@ export class FakeFsWebdav extends FakeFs {
|
|||||||
console.debug(`tmpFolderName=${tmpFolderName}`);
|
console.debug(`tmpFolderName=${tmpFolderName}`);
|
||||||
|
|
||||||
const clientForUpload = createClient(uploadServerAddress, {
|
const clientForUpload = createClient(uploadServerAddress, {
|
||||||
username: this.webdavConfig.username,
|
username: tryEncodeUsernamePassword(this.webdavConfig.username),
|
||||||
password: this.webdavConfig.password,
|
password: tryEncodeUsernamePassword(this.webdavConfig.password),
|
||||||
headers: {
|
headers: {
|
||||||
"Cache-Control": "no-cache",
|
"Cache-Control": "no-cache",
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user