Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: dnd to a dir with escaped characters #1764

Merged
merged 1 commit into from
Apr 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export class App extends Component {
doUpdateHash: PropTypes.func.isRequired,
doFilesWrite: PropTypes.func.isRequired,
routeInfo: PropTypes.object.isRequired,
filesPathInfo: PropTypes.object,
// Injected by DropTarget
isOver: PropTypes.bool.isRequired
}
Expand All @@ -35,9 +36,9 @@ export class App extends Component {
}

addFiles = async (filesPromise) => {
const { doFilesWrite, doUpdateHash, routeInfo } = this.props
const { doFilesWrite, doUpdateHash, routeInfo, filesPathInfo } = this.props
const isFilesPage = routeInfo.pattern === '/files*'
const addAtPath = isFilesPage ? routeInfo.params.path : '/'
const addAtPath = isFilesPage ? (filesPathInfo?.realPath || routeInfo.params.path) : '/'
const files = await filesPromise

doFilesWrite(normalizeFiles(files), addAtPath)
Expand Down
6 changes: 4 additions & 2 deletions src/bundles/files/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,10 @@ const actions = () => ({
try {
await ipfs.files.cp(src, dst)
} catch (err) {
throw Object.assign(new Error('Folder already exists.'), {
code: 'ERR_FOLDER_EXISTS'
// TODO: Not sure why we do this. Perhaps a generic error is used
// to avoid leaking private information via Countly?
throw Object.assign(new Error('ipfs.files.cp call failed'), {
code: 'ERR_FILES_CP_FAILED'
})
}
}
Expand Down