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 props = item.propstat.prop
const isDir = !isNil(props.resourcetype?.collection) const isDir = !isNil(props.resourcetype?.collection)
const href = decodeURIComponent(item.href) 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 { return {
filename, filename: filename.endsWith('/') ? filename.slice(0, -1) : filename,
basename: path.basename(filename), basename: path.basename(filename),
lastmod: props.getlastmodified || '', lastmod: props.getlastmodified || '',
size: props.getcontentlength ? parseInt(props.getcontentlength, 10) : 0, size: props.getcontentlength ? parseInt(props.getcontentlength, 10) : 0,

View File

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