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

NXDRIVE-2861: Fix behavior when not entering the correct URL format #4231

Closed
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
1 change: 1 addition & 0 deletions docs/changes/5.3.3.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 4 additions & 0 deletions nxdrive/gui/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -784,6 +784,10 @@
return

# Handle the server URL
if "login.jsp" in server_url:
self.setMessage.emit("CONNECTION_ERROR", "error")
return

Check warning on line 789 in nxdrive/gui/api.py

View check run for this annotation

Codecov / codecov/patch

nxdrive/gui/api.py#L787-L789

Added lines #L787 - L789 were not covered by tests

error = ""
try:
error = self._get_ssl_error(server_url)
Expand Down
34 changes: 34 additions & 0 deletions tests/functional/test_api.py
Original file line number Diff line number Diff line change
@@ -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