diff --git a/docs/changes/5.3.3.md b/docs/changes/5.3.3.md index 3f85fecd63..20896bb2b1 100644 --- a/docs/changes/5.3.3.md +++ b/docs/changes/5.3.3.md @@ -5,6 +5,7 @@ Release date: `2023-xx-xx` ## Core - [NXDRIVE-2828](https://jira.nuxeo.com/browse/NXDRIVE-2828): Remove sensitive information from Drive logs +- [NXDRIVE-2861](https://jira.nuxeo.com/browse/NXDRIVE-2861): Fix behavior when not entering the correct URL format ### Direct Edit diff --git a/nxdrive/gui/api.py b/nxdrive/gui/api.py index 5e3f4372ba..fef78cffcf 100644 --- a/nxdrive/gui/api.py +++ b/nxdrive/gui/api.py @@ -784,6 +784,10 @@ def web_authentication( return # Handle the server URL + if "login.jsp" in server_url: + self.setMessage.emit("CONNECTION_ERROR", "error") + return + error = "" try: error = self._get_ssl_error(server_url) diff --git a/tests/functional/test_api.py b/tests/functional/test_api.py new file mode 100644 index 0000000000..a1d7a14ead --- /dev/null +++ b/tests/functional/test_api.py @@ -0,0 +1,34 @@ +from collections import namedtuple +from unittest.mock import patch + +from nxdrive.gui.api import QMLDriveApi + + +def test_web_authentication(manager_factory, nuxeo_url): + manager = manager_factory(with_engine=False) + manager.application = "" + + def func(*args): + return True + + def mocked_open_authentication_dialog(): + return + + Mocked_App = namedtuple( + "app", + "manager, open_authentication_dialog", + defaults=(manager, mocked_open_authentication_dialog), + ) + app = Mocked_App() + + drive_api = QMLDriveApi(app) + + with manager: + with patch.object(manager, "check_local_folder_available", new=func): + url = f"{nuxeo_url}/login.jsp?requestedUrl=ui%2F" + returned_val = drive_api.web_authentication( + url, + "/dummy-path", + True, + ) + assert not returned_val