Skip to content

Commit 80688dd

Browse files
committed
small fixes
1 parent cac5535 commit 80688dd

File tree

3 files changed

+17
-19
lines changed

3 files changed

+17
-19
lines changed

app/templates/view_validators.html

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -53,20 +53,18 @@ <h2>Validation Results</h2>
5353
{% if not data.record_errors %}
5454
<p>No validation errors found</p>
5555
{% else %}
56-
<div class="usa-table-container" tabindex="0">
57-
<div class="error-list">
58-
{% for record_error in data.record_errors %}
59-
<div class="error-block">
60-
<p style="word-break: break-all"><strong>Identifier:</strong> {{ record_error[0] ~ " (dataset position)" if record_error[0] is number else record_error[0] }}</p>
61-
<p>
62-
<strong>Error Message:</strong>
63-
<ul>
64-
<li>{{ record_error[1] }}</li>
65-
</ul>
66-
</p>
67-
</div>
68-
{% endfor %}
56+
<div class="error-list">
57+
{% for record_error in data.record_errors %}
58+
<div class="error-block">
59+
<p style="word-break: break-all"><strong>Identifier:</strong> {{ record_error[0] ~ " (dataset position)" if record_error[0] is number else record_error[0] }}</p>
60+
<p>
61+
<strong>Error Message:</strong>
62+
<ul>
63+
<li>{{ record_error[1] }}</li>
64+
</ul>
65+
</p>
6966
</div>
67+
{% endfor %}
7068
</div>
7169
{% endif %}
7270
{% endif %}
@@ -76,7 +74,7 @@ <h2>Validation Results</h2>
7674

7775
{% block scripts %}
7876

79-
<script>
77+
<script nonce="{{ csp_nonce() }}">
8078
function toggleInputFields() {
8179
const method = document.getElementById("fetch_method").value;
8280

app/util.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def is_public_ip(hostname: str) -> bool:
9999

100100
def fetch_json_from_url(url: str) -> dict:
101101

102-
MAX_CONTENT_LENGTH = 10 * 1024 * 1024 # 10MB limit
102+
max_content_length = 10 * 1024 * 1024 # 10MB limit
103103

104104
parsed = urlparse(url)
105105

@@ -123,8 +123,8 @@ def fetch_json_from_url(url: str) -> dict:
123123
if "application/json" not in content_type:
124124
raise ValueError("URL did not return JSON.")
125125

126-
content = response.raw.read(MAX_CONTENT_LENGTH + 1)
127-
if len(content) > MAX_CONTENT_LENGTH:
126+
content = response.raw.read(max_content_length + 1)
127+
if len(content) > max_content_length:
128128
raise ValueError("JSON payload too large.")
129129

130130
return response.json()

tests/playwright/test_validator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def test_ui_validate_by_url(self, upage):
3737
upage.locator("input[type=submit]").click()
3838

3939
# error table should be visible and with 5 validation errors
40-
expect(upage.locator(".usa-table-container")).to_be_visible()
40+
expect(upage.locator(".error-list")).to_be_visible()
4141
expect(upage.locator(".error-block")).to_have_count(5)
4242

4343
def test_ui_validate_by_json(self, upage, dcatus_long_description_json):
@@ -53,7 +53,7 @@ def test_ui_validate_by_json(self, upage, dcatus_long_description_json):
5353
upage.locator("input[type=submit]").click()
5454

5555
# error table should be visible and with 5 validation errors
56-
expect(upage.locator(".usa-table-container")).to_be_visible()
56+
expect(upage.locator(".error-list")).to_be_visible()
5757
expect(upage.locator(".error-block")).to_have_count(1)
5858

5959
def test_api_validate_by_url(self, upage, validator_api_url):

0 commit comments

Comments
 (0)