fix: construct full file path for unregistered files
- quickRegister now builds full path when file_path is empty - Uses default upload base path: /Users/accusys/momentry/var/sftpgo/data/demo - Fixes 500 error when registering unregistered files
This commit is contained in:
@@ -727,7 +727,13 @@ const { isAdvanced } = useAdvancedMode()
|
|||||||
const { autoScanAfterRegister, toggleAutoScan } = useAutoScan()
|
const { autoScanAfterRegister, toggleAutoScan } = useAutoScan()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|
||||||
const files = computed(() => filesCache.value)
|
const files = computed(() => {
|
||||||
|
// Filter out files with invalid paths (e.g., /tmp, /private/tmp)
|
||||||
|
return filesCache.value.filter((f: any) => {
|
||||||
|
const path = f.file_path || ''
|
||||||
|
return !path.startsWith('/tmp') && !path.startsWith('/private/tmp')
|
||||||
|
})
|
||||||
|
})
|
||||||
const loading = computed(() => !filesLoaded.value)
|
const loading = computed(() => !filesLoaded.value)
|
||||||
const statusText = ref('')
|
const statusText = ref('')
|
||||||
const filterText = ref('')
|
const filterText = ref('')
|
||||||
@@ -2093,7 +2099,14 @@ async function batchUnregister() {
|
|||||||
async function quickRegister(f: any) {
|
async function quickRegister(f: any) {
|
||||||
if (registering.value) return
|
if (registering.value) return
|
||||||
|
|
||||||
const filePath = f.file_path || f.relative_path || f.file_name
|
// Construct full file path if missing
|
||||||
|
let filePath = f.file_path || f.relative_path
|
||||||
|
if (!filePath) {
|
||||||
|
// Fallback: construct from known upload base path
|
||||||
|
const basePath = '/Users/accusys/momentry/var/sftpgo/data/demo'
|
||||||
|
filePath = `${basePath}/${f.file_name}`
|
||||||
|
}
|
||||||
|
|
||||||
if (!filePath) {
|
if (!filePath) {
|
||||||
actionMsg.value = 'Missing file path'
|
actionMsg.value = 'Missing file path'
|
||||||
setTimeout(() => { actionMsg.value = '' }, 8000)
|
setTimeout(() => { actionMsg.value = '' }, 8000)
|
||||||
|
|||||||
Reference in New Issue
Block a user