diff --git a/java/src/org/openqa/selenium/grid/node/Node.java b/java/src/org/openqa/selenium/grid/node/Node.java index 8171a0f753d75..efd16c75f0bde 100644 --- a/java/src/org/openqa/selenium/grid/node/Node.java +++ b/java/src/org/openqa/selenium/grid/node/Node.java @@ -171,9 +171,6 @@ protected Node( get("/session/{sessionId}/se/files") .to(params -> new DownloadFile(this, sessionIdFrom(params))) .with(spanDecorator("node.download_file")), - get("/session/{sessionId}/se/files/{fileName}") - .to(params -> new DownloadFile(this, sessionIdFrom(params))) - .with(spanDecorator("node.download_file")), post("/session/{sessionId}/se/files") .to(params -> new DownloadFile(this, sessionIdFrom(params))) .with(spanDecorator("node.download_file")), diff --git a/java/src/org/openqa/selenium/grid/node/local/LocalNode.java b/java/src/org/openqa/selenium/grid/node/local/LocalNode.java index bb5576a6c9c5e..8041b97fc74b5 100644 --- a/java/src/org/openqa/selenium/grid/node/local/LocalNode.java +++ b/java/src/org/openqa/selenium/grid/node/local/LocalNode.java @@ -931,11 +931,6 @@ public HttpResponse downloadFile(HttpRequest req, SessionId id) { if (req.getMethod().equals(HttpMethod.GET) && req.getUri().endsWith("/se/files")) { return listDownloadedFiles(downloadsDirectory); } - if (req.getMethod().equals(HttpMethod.GET)) { - // Left here for backward compatibility. - // Remove this IF in Selenium 4.41, 4.42 or 4.43 - return getDownloadedFile(downloadsDirectory, extractFileName(req)); - } if (req.getMethod().equals(HttpMethod.DELETE)) { return deleteDownloadedFile(downloadsDirectory); } @@ -945,21 +940,6 @@ public HttpResponse downloadFile(HttpRequest req, SessionId id) { } } - private String extractFileName(HttpRequest req) { - return extractFileName(req.getUri()); - } - - String extractFileName(String uri) { - String prefix = "/se/files/"; - int index = uri.lastIndexOf(prefix); - if (index < 0) { - throw new IllegalArgumentException("Unexpected URL for downloading a file: " + uri); - } - // The server has already decoded the path of the request, so the file name needs no - // further processing to match the name of the file on disk. - return uri.substring(index + prefix.length()); - } - /** User wants to list files that can be downloaded */ private HttpResponse listDownloadedFiles(File downloadsDirectory) { File[] files = Optional.ofNullable(downloadsDirectory.listFiles()).orElse(new File[] {}); @@ -1037,17 +1017,6 @@ private HttpResponse getDownloadedFile(HttpRequest req, File downloadsDirectory) return new HttpResponse().setContent(asJson(result)); } - /** Left here for backward compatibility. Remove this method in Selenium 4.41, 4.42 or 4.43 */ - @Deprecated - private HttpResponse getDownloadedFile(File downloadsDirectory, String fileName) - throws IOException { - if (fileName.isEmpty()) { - throw new WebDriverException("Please specify file to download in URL"); - } - File file = findDownloadedFile(downloadsDirectory, fileName); - return fileAsBinaryResponse(file); - } - private HttpResponse fileAsBinaryResponse(File file) throws IOException { BasicFileAttributes attributes = readAttributes(file.toPath(), BasicFileAttributes.class); return new HttpResponse() diff --git a/java/src/org/openqa/selenium/remote/DriverCommand.java b/java/src/org/openqa/selenium/remote/DriverCommand.java index 56365f8e74428..9ab943f5ebbfa 100644 --- a/java/src/org/openqa/selenium/remote/DriverCommand.java +++ b/java/src/org/openqa/selenium/remote/DriverCommand.java @@ -217,16 +217,6 @@ public interface DriverCommand { String GET_DOWNLOADABLE_FILES = "getDownloadableFiles"; String DOWNLOAD_FILE = "downloadFile"; - /** - * This endpoint was introduced in 4.39.0, but not used anymore since 4.40.0. Left here for - * backward compatibility (if someone uses Grid 4.40+, but Client 4.39.0). - * - *

Remove it in 4.41, 4.42 or 4.43. - * - * @deprecated use {@link #DOWNLOAD_FILE} instead - */ - @Deprecated String GET_DOWNLOADED_FILE = "getDownloadedFile"; - String DELETE_DOWNLOADABLE_FILES = "deleteDownloadableFiles"; String FIRE_SESSION_EVENT = "fireSessionEvent"; diff --git a/java/src/org/openqa/selenium/remote/codec/AbstractHttpCommandCodec.java b/java/src/org/openqa/selenium/remote/codec/AbstractHttpCommandCodec.java index dd16eb6ea578a..42e5d36d1d065 100644 --- a/java/src/org/openqa/selenium/remote/codec/AbstractHttpCommandCodec.java +++ b/java/src/org/openqa/selenium/remote/codec/AbstractHttpCommandCodec.java @@ -47,7 +47,6 @@ import static org.openqa.selenium.remote.DriverCommand.GET_CREDENTIALS; import static org.openqa.selenium.remote.DriverCommand.GET_CURRENT_URL; import static org.openqa.selenium.remote.DriverCommand.GET_DOWNLOADABLE_FILES; -import static org.openqa.selenium.remote.DriverCommand.GET_DOWNLOADED_FILE; import static org.openqa.selenium.remote.DriverCommand.GET_ELEMENT_RECT; import static org.openqa.selenium.remote.DriverCommand.GET_ELEMENT_TAG_NAME; import static org.openqa.selenium.remote.DriverCommand.GET_ELEMENT_TEXT; @@ -202,7 +201,6 @@ public AbstractHttpCommandCodec() { defineCommand(GET_DOWNLOADABLE_FILES, get(sessionId + "/se/files")); defineCommand(DOWNLOAD_FILE, post(sessionId + "/se/files")); - defineCommand(GET_DOWNLOADED_FILE, get(sessionId + "/se/files/:name")); defineCommand(DELETE_DOWNLOADABLE_FILES, delete(sessionId + "/se/files")); defineCommand(FIRE_SESSION_EVENT, post(sessionId + "/se/event")); diff --git a/java/test/org/openqa/selenium/grid/node/local/LocalNodeTest.java b/java/test/org/openqa/selenium/grid/node/local/LocalNodeTest.java index a3ccfd06f63bb..26b0f534597ff 100644 --- a/java/test/org/openqa/selenium/grid/node/local/LocalNodeTest.java +++ b/java/test/org/openqa/selenium/grid/node/local/LocalNodeTest.java @@ -428,15 +428,6 @@ void bidiIsDisabledAndResponseCapsShowThat() throws URISyntaxException { assertThat(Boolean.parseBoolean(bidiEnabled.toString())).isFalse(); } - @Test - void extractsFileNameFromRequestUri() { - assertThat(node.extractFileName("/session/1234/se/files/logo.png")).isEqualTo("logo.png"); - assertThat(node.extractFileName("/session/1234/se/files/файл+with+tähtedega.png")) - .isEqualTo("файл+with+tähtedega.png"); - assertThat(node.extractFileName("/session/1234/se/files/attestation pour l'employeur.pdf")) - .isEqualTo("attestation pour l'employeur.pdf"); - } - @Test void commandInterceptorIsCalledForEachWebDriverCommand() throws URISyntaxException { Tracer tracer = DefaultTestTracer.createTracer();