Skip to content

Commit 54db347

Browse files
committed
Refactor: Clean up whitespace in deep link handling functions and tests
1 parent 2ae87fc commit 54db347

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

front/index.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@ function validate_local_path(?string $encoded): string {
4444
function extract_hash_from_path(string $path): array {
4545
/*
4646
Split a path into path and hash components.
47-
47+
4848
For deep links encoded in the 'next' parameter like /devices.php#device-123,
4949
extract the hash fragment so it can be properly included in the redirect.
50-
50+
5151
Args:
5252
path: Full path potentially with hash (e.g., "/devices.php#device-123")
53-
53+
5454
Returns:
5555
Array with keys 'path' (without hash) and 'hash' (with # prefix, or empty string)
5656
*/
@@ -67,7 +67,7 @@ function append_hash(string $url): string {
6767
if (!empty($parts['hash'])) {
6868
return $parts['path'] . $parts['hash'];
6969
}
70-
70+
7171
// Fall back to POST url_hash (for browser-captured hashes)
7272
if (!empty($_POST['url_hash'])) {
7373
$sanitized = preg_replace('/[^#a-zA-Z0-9_\-]/', '', $_POST['url_hash']);

test/ui/test_ui_login.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ def test_login_redirects_to_devices(driver):
137137

138138
def test_login_with_deep_link_preserves_hash(driver):
139139
"""Test: Login with deep link (?next=...) preserves the URL fragment hash
140-
140+
141141
When a user logs in from a deep link URL (e.g., ?next=base64(devices.php%23device-123)),
142142
they should be redirected to the target page with the hash fragment intact.
143143
"""
@@ -162,7 +162,7 @@ def test_login_with_deep_link_preserves_hash(driver):
162162
# Check that we're on the right page with the hash preserved
163163
current_url = driver.current_url
164164
print(f"URL after login with deep link: {current_url}")
165-
165+
166166
if '/devices.php' not in current_url:
167167
pytest.skip(f"Login failed or redirect not configured. URL: {current_url}")
168168

@@ -172,7 +172,7 @@ def test_login_with_deep_link_preserves_hash(driver):
172172

173173
def test_login_with_deep_link_to_network_page(driver):
174174
"""Test: Login with deep link to network.php page preserves hash
175-
175+
176176
User can login with a deep link to the network page (e.g., network.php#settings-panel),
177177
and should be redirected to that page with the hash fragment intact.
178178
"""
@@ -197,7 +197,7 @@ def test_login_with_deep_link_to_network_page(driver):
197197
# Check that we're on the right page with the hash preserved
198198
current_url = driver.current_url
199199
print(f"URL after login with network.php deep link: {current_url}")
200-
200+
201201
if '/network.php' not in current_url:
202202
pytest.skip(f"Login failed or redirect not configured. URL: {current_url}")
203203

@@ -233,7 +233,7 @@ def test_login_without_next_parameter(driver):
233233

234234
def test_url_hash_hidden_input_present(driver):
235235
"""Test: URL fragment hash field is present in login form
236-
236+
237237
The hidden url_hash input field is used to capture and preserve
238238
URL hash fragments during form submission and redirect.
239239
"""

0 commit comments

Comments
 (0)