fix(NutstoreService): Fix slash handling in path processing #4208
This commit is contained in:
parent
0fd9b6e56c
commit
d2ed9972bd
@ -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,
|
||||||
|
|||||||
@ -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 />
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user