@@ -34,7 +34,7 @@ export async function judgeDirExist(context: WebDAVContext, dirPath: string): Pr
3434 const method = 'PROPFIND'
3535 headers . append ( 'Accept' , 'text/plain,application/xml' )
3636 headers . append ( 'Depth' , '1' )
37- const response = await fetch ( url , { method, headers } )
37+ const response = await fetch ( url , { method, headers, credentials : "omit" } )
3838 const status = response ?. status
3939 if ( status == 207 ) {
4040 return true
@@ -62,7 +62,7 @@ export async function makeDirs(context: WebDAVContext, dirPath: string) {
6262 if ( ! exists ) {
6363 const url = `${ endpoint } /${ currentPath } `
6464 const headers = authHeaders ( auth )
65- const response = await fetch ( url , { method : 'MKCOL' , headers } )
65+ const response = await fetch ( url , { method : 'MKCOL' , headers, credentials : "omit" } )
6666 handleWriteResponse ( response )
6767 }
6868 }
@@ -72,7 +72,7 @@ export async function deleteDir(context: WebDAVContext, dirPath: string) {
7272 const { auth, endpoint } = context || { }
7373 const url = `${ endpoint } /${ dirPath } `
7474 const headers = authHeaders ( auth )
75- const response = await fetchDelete ( url , { headers } )
75+ const response = await fetchDelete ( url , { headers, credentials : "omit" } )
7676 const status = response . status
7777 if ( status === 403 ) {
7878 throw new Error ( "Unauthorized to delete directory" )
@@ -87,7 +87,7 @@ export async function writeFile(context: WebDAVContext, filePath: string, conten
8787 const headers = authHeaders ( auth )
8888 headers . set ( "Content-Type" , "application/octet-stream" )
8989 const url = `${ endpoint } /${ filePath } `
90- const response = await fetch ( url , { headers, method : 'put' , body : content } )
90+ const response = await fetch ( url , { headers, method : 'put' , body : content , credentials : "omit" } )
9191 handleWriteResponse ( response )
9292}
9393
@@ -106,7 +106,7 @@ export async function readFile(context: WebDAVContext, filePath: string): Promis
106106 const headers = authHeaders ( auth )
107107 const url = `${ endpoint } /${ filePath } `
108108 try {
109- const response = await fetchGet ( url , { headers } )
109+ const response = await fetchGet ( url , { headers, credentials : "omit" } )
110110 const status = response ?. status
111111 if ( status === 200 ) {
112112 return response . text ( )
0 commit comments