Skip to content

Commit

Permalink
Small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
justinnas committed Sep 9, 2024
1 parent 46ed81c commit 7c8efac
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
8 changes: 0 additions & 8 deletions app/back-end/src/routes/workspace_route.py
Original file line number Diff line number Diff line change
Expand Up @@ -1198,14 +1198,6 @@ def export_file(relative_path):

response = send_file(file_path, as_attachment=True)

# Emit success message after file export is successful
#socketio_emit_to_user_session(
# CONSOLE_FEEDBACK_EVENT,
# {"type": "succ", "message": f"File '{relative_path}' was exported successfully."},
# uuid,
# sid,
#)

except FileNotFoundError as e:
logger.error("FileNotFoundError: %s while accessing %s", e, user_workspace_dir)
# Emit a feedback to the user's console
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,9 @@ export const FileTreeItemContextMenu: React.FC<FileTreeItemContextMenuProps> = (
responseType: 'blob',
});
const url = window.URL.createObjectURL(new Blob([response.data]));
console.log(item.id);

const fileName = item.id.match(/[^/\\]+$/)?.[0] || item.id; // Extracts only the file name, otherwise uses the full path

const link = Object.assign(document.createElement('a'), {
href: url,
download: fileName,
Expand All @@ -176,7 +177,7 @@ export const FileTreeItemContextMenu: React.FC<FileTreeItemContextMenuProps> = (
// TODO: Implement socket console event for successful file export
console.log('Exported:', fileName);
} catch (error) {
console.error('Error exporting the file:', error);
console.error('Error exporting file:', error);
}
};

Expand Down

0 comments on commit 7c8efac

Please sign in to comment.