fix(NutstoreService): Fix slash handling in path processing #4208

This commit is contained in:
kanweiwei 2025-04-02 09:59:21 +08:00 committed by 亢奋猫
parent 0fd9b6e56c
commit d2ed9972bd
2 changed files with 6 additions and 4 deletions

View File

@ -112,10 +112,10 @@ function convertToFileStat(serverBase: string, item: WebDAVResponse['multistatus
const props = item.propstat.prop
const isDir = !isNil(props.resourcetype?.collection)
const href = decodeURIComponent(item.href)
const filename = serverBase === '/' ? href : path.join('/', href.replace(serverBase, ''))
const filename = serverBase === '/' ? href : path.posix.join('/', href.replace(serverBase, ''))
return {
filename,
filename: filename.endsWith('/') ? filename.slice(0, -1) : filename,
basename: path.basename(filename),
lastmod: props.getlastmodified || '',
size: props.getcontentlength ? parseInt(props.getcontentlength, 10) : 0,

View File

@ -252,8 +252,10 @@ const NutstoreSettings: FC = () => {
placeholder={t('settings.data.nutstore.path.placeholder')}
style={{ width: 250 }}
value={nutstorePath}
onChange={(e) => setStoragePath(e.target.value)}
onBlur={() => dispatch(setNutstorePath(storagePath || ''))}
onChange={(e) => {
setStoragePath(e.target.value)
dispatch(setNutstorePath(e.target.value))
}}
/>
<Button type="default" onClick={handleClickPathChange}>
<FolderOutlined />