diff --git a/src/App.js b/src/App.js index ed82533a2..adc24d3c5 100644 --- a/src/App.js +++ b/src/App.js @@ -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 } @@ -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) diff --git a/src/bundles/files/actions.js b/src/bundles/files/actions.js index fe0bf28fc..8b56c0913 100644 --- a/src/bundles/files/actions.js +++ b/src/bundles/files/actions.js @@ -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' }) } }