uranusjr commented on a change in pull request #18161:
URL: https://github.com/apache/airflow/pull/18161#discussion_r715157996



##########
File path: airflow/www/views.py
##########
@@ -3350,39 +3350,67 @@ def action_muldelete(self, items):
             (permissions.ACTION_CAN_READ, permissions.RESOURCE_CONNECTION),
         ]
     )
+
     def action_mulduplicate(self, connections, session=None):
         """Duplicate Multiple connections"""
         for selected_conn in connections:
             new_conn_id = selected_conn.conn_id
             match = re.search(r"_copy(\d+)$", selected_conn.conn_id)
+
+            base_conn_id = selected_conn.conn_id
             if match:
-                conn_id_prefix = selected_conn.conn_id[: match.start()]
-                new_conn_id = f"{conn_id_prefix}_copy{int(match.group(1)) + 1}"
+                base_conn_id = base_conn_id.split('_copy')[0]

Review comment:
       ```suggestion
                   base_conn_id = selected_conn.conn_id[: match.start()]
   ```
   
   Avoid parsing the ID twice.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to