Skip to content

Commit 63a9795

Browse files
icecrasher321waleedlatif1
authored andcommitted
address next set
1 parent 8fa13aa commit 63a9795

2 files changed

Lines changed: 10 additions & 8 deletions

File tree

  • apps/sim/app

apps/sim/app/api/workspaces/[id]/files/download/route.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,11 @@ export const GET = withRouteHandler(
102102
const usedPaths = new Set<string>()
103103
for (const file of filesToZip) {
104104
const buffer = await fetchWorkspaceFileBuffer(file)
105-
const basePath = safeZipPath(
106-
file.folderPath ? `${file.folderPath}/${file.name}` : file.name
107-
)
108-
let zipPath = basePath || file.name
105+
const basePath =
106+
safeZipPath(file.folderPath ? `${file.folderPath}/${file.name}` : file.name) ||
107+
safeZipPath(file.name) ||
108+
file.id
109+
let zipPath = basePath
109110
let suffix = 2
110111
while (usedPaths.has(zipPath)) {
111112
const dotIndex = basePath.lastIndexOf('.')

apps/sim/app/workspace/[workspaceId]/files/files.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -435,8 +435,6 @@ export function Files() {
435435
if (row.id !== listRename.editingId) return row
436436
const parsed = parseRowId(row.id)
437437
const file = parsed.kind === 'file' ? filteredFiles.find((f) => f.id === parsed.id) : null
438-
const folder =
439-
parsed.kind === 'folder' ? visibleFolders.find((item) => item.id === parsed.id) : null
440438
const Icon = file ? getDocumentIcon(file.type || '', file.name) : Folder
441439
return {
442440
...row,
@@ -469,7 +467,6 @@ export function Files() {
469467
listRename.submitRename,
470468
listRename.cancelRename,
471469
filteredFiles,
472-
visibleFolders,
473470
])
474471

475472
const visibleRowIds = useMemo(() => rows.map((row) => row.id), [rows])
@@ -817,11 +814,15 @@ export function Files() {
817814
fileIds: target.fileIds,
818815
folderIds: target.folderIds,
819816
})
820-
} else {
817+
} else if (target.fileIds.length === 1) {
821818
await deleteFile.mutateAsync({
822819
workspaceId,
823820
fileId: target.fileIds[0],
824821
})
822+
} else {
823+
setShowDeleteConfirm(false)
824+
setDeleteTarget(null)
825+
return
825826
}
826827
setShowDeleteConfirm(false)
827828
setDeleteTarget(null)

0 commit comments

Comments
 (0)