This is an automated email from the ASF dual-hosted git repository.

sbp pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tooling-trusted-releases.git


The following commit(s) were added to refs/heads/main by this push:
     new 49b7cdd  Restore validation of the announce download path and update 
tests
49b7cdd is described below

commit 49b7cddc8605c22b5ffa01bbc60d246cb24c2e6e
Author: Sean B. Palmer <[email protected]>
AuthorDate: Thu Jan 8 16:00:15 2026 +0000

    Restore validation of the announce download path and update tests
---
 atr/static/js/src/announce-confirm.js | 50 ++++++++++++++++++++++++++++++++++-
 tests/e2e/announce/test_get.py        | 41 ----------------------------
 2 files changed, 49 insertions(+), 42 deletions(-)

diff --git a/atr/static/js/src/announce-confirm.js 
b/atr/static/js/src/announce-confirm.js
index f33177a..f4fd429 100644
--- a/atr/static/js/src/announce-confirm.js
+++ b/atr/static/js/src/announce-confirm.js
@@ -40,4 +40,52 @@ function initAnnounceConfirm() {
        updateButtonState();
 }
 
-document.addEventListener("DOMContentLoaded", initAnnounceConfirm);
+function initDownloadPathValidation() {
+       const pathInput = document.getElementById("download_path_suffix");
+       const pathHelpText = pathInput
+               ? pathInput.parentElement.querySelector(".form-text")
+               : null;
+
+       if (!pathInput || !pathHelpText) {
+               return;
+       }
+
+       const baseText = pathHelpText.dataset.baseText || "";
+       let pathDebounce;
+
+       const updatePathHelpText = () => {
+               let suffix = pathInput.value;
+               if (suffix.includes("..") || suffix.includes("//")) {
+                       pathHelpText.textContent =
+                               "Download path suffix must not contain .. or 
//";
+                       return;
+               }
+               if (suffix.startsWith("./")) {
+                       suffix = suffix.slice(1);
+               } else if (suffix === ".") {
+                       suffix = "/";
+               }
+               if (!suffix.startsWith("/")) {
+                       suffix = `/${suffix}`;
+               }
+               if (!suffix.endsWith("/")) {
+                       suffix = `${suffix}/`;
+               }
+               if (suffix.includes("/.")) {
+                       pathHelpText.textContent = "Download path suffix must 
not contain /.";
+                       return;
+               }
+               pathHelpText.textContent = baseText + suffix;
+       };
+
+       pathInput.addEventListener("input", () => {
+               clearTimeout(pathDebounce);
+               pathDebounce = setTimeout(updatePathHelpText, 10);
+       });
+       updatePathHelpText();
+}
+
+document.addEventListener("DOMContentLoaded", () => {
+       initAnnounceConfirm();
+       initDownloadPathValidation();
+});
diff --git a/tests/e2e/announce/test_get.py b/tests/e2e/announce/test_get.py
index 65731e1..56cf800 100644
--- a/tests/e2e/announce/test_get.py
+++ b/tests/e2e/announce/test_get.py
@@ -19,19 +19,6 @@ import e2e.announce.helpers as helpers  # type: 
ignore[reportMissingImports]
 from playwright.sync_api import Page, expect
 
 
-def test_copy_variable_button_shows_feedback(page_announce: Page) -> None:
-    """Clicking a copy variable button should show feedback."""
-    variables_tab = page_announce.get_by_role("tab", name="Variables")
-    variables_tab.click()
-
-    copy_button = page_announce.locator(".copy-var-btn").first
-    expect(copy_button).to_have_text("Copy")
-
-    copy_button.click()
-
-    expect(copy_button).to_have_text("Copied!")
-
-
 def test_path_adds_leading_slash(page_announce: Page) -> None:
     """Paths without a leading '/' should have one added."""
     help_text = helpers.fill_path_suffix(page_announce, "apple/banana")
@@ -77,34 +64,6 @@ def test_path_rejects_hidden_directory(page_announce: Page) 
-> None:
     expect(help_text).to_contain_text("must not contain /.")
 
 
-def test_preview_loads_on_page_load(page_announce: Page) -> None:
-    """The preview should automatically fetch and display on page load."""
-    preview_tab = page_announce.get_by_role("tab", name="Preview")
-    preview_tab.click()
-
-    preview_content = page_announce.locator("#announce-body-preview-content")
-    expect(preview_content).to_be_visible()
-    expect(preview_content).not_to_be_empty()
-
-
-def test_preview_updates_on_body_input(page_announce: Page) -> None:
-    """Typing in the body textarea should update the preview."""
-    preview_tab = page_announce.get_by_role("tab", name="Preview")
-    preview_content = page_announce.locator("#announce-body-preview-content")
-
-    preview_tab.click()
-    initial_preview = preview_content.text_content()
-
-    edit_tab = page_announce.get_by_role("tab", name="Edit")
-    edit_tab.click()
-
-    body_textarea = page_announce.locator("#body")
-    body_textarea.fill("Custom test announcement body content")
-
-    preview_tab.click()
-    expect(preview_content).not_to_have_text(initial_preview or "")
-
-
 def test_submit_button_disabled_until_confirm_typed(page_announce: Page) -> 
None:
     """The submit button should be disabled until CONFIRM is typed."""
     submit_button = page_announce.get_by_role("button", name="Send 
announcement email")


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to