Skip to content

Commit

Permalink
fix: dont error if path doesn't exist
Browse files Browse the repository at this point in the history
  • Loading branch information
SgtPooki committed Mar 5, 2025
1 parent d1ae76f commit 2b929fc
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/bundles/files/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -418,15 +418,19 @@ const actions = () => ({
const dst = realMfsPath(join(root, name))
let dstExists = false

// Check if destination path already exists
await ipfs.files.stat(dst).then(() => {
dstExists = true
}).catch(() => {
// Swallow error. We can add the file to the dst path
})
try {
// Check if destination path already exists
await ipfs.files.stat(dst).then(() => {
dstExists = true
}).catch(() => {
// Swallow error. We can add the file to the dst path
})

if (dstExists) {
throw new Error(`The name "${name}" already exists in the current directory. Try importing with a different name.`)
if (dstExists) {
throw new Error(`The name "${name}" already exists in the current directory. Try importing with a different name.`)
}
} catch (/** @type {any} */ err) {
// Swallow error. We can add the file to the dst path
}

try {
Expand Down

0 comments on commit 2b929fc

Please sign in to comment.