🐛 Fix(custom): fix webdav buffer usage

ISSUES CLOSED: #384
This commit is contained in:
Kuingsmile
2025-09-03 13:27:02 +08:00
parent ef7752bb7f
commit 58ba8331cc
4 changed files with 9 additions and 2 deletions

View File

@@ -94,6 +94,9 @@ try {
}, },
mime: { mime: {
lookup: mime.getType lookup: mime.getType
},
buffer: {
from: Buffer.from
} }
}) })
} catch (error) { } catch (error) {

View File

@@ -61,7 +61,8 @@ async function getWebdavHeader(key: string) {
} }
} else { } else {
headers = { headers = {
Authorization: 'Basic ' + Buffer.from(`${props.config.username}:${props.config.password}`).toString('base64') Authorization:
'Basic ' + window.node.buffer.from(`${props.config.username}:${props.config.password}`).toString('base64')
} }
} }
return headers return headers

View File

@@ -1756,7 +1756,7 @@ async function handleClickFile(item: any) {
const options = {} as any const options = {} as any
if (currentPicBedName.value === 'webdavplist') { if (currentPicBedName.value === 'webdavplist') {
options.headers = { options.headers = {
Authorization: `Basic ${Buffer.from(`${manageStore.config.picBed[configMap.alias].username}:${manageStore.config.picBed[configMap.alias].password}`).toString('base64')}` Authorization: `Basic ${window.node.buffer.from(`${manageStore.config.picBed[configMap.alias].username}:${manageStore.config.picBed[configMap.alias].password}`).toString('base64')}`
} }
} }
if (item.isImage) { if (item.isImage) {

View File

@@ -63,6 +63,9 @@ declare global {
mime: { mime: {
lookup: typeof mime.getType lookup: typeof mime.getType
} }
buffer: {
from: typeof Buffer.from
}
} }
i18n: { i18n: {
setLocales: (lang: string, locales: ILocales) => void setLocales: (lang: string, locales: ILocales) => void