pjfanning commented on code in PR #1807:
URL: https://github.com/apache/pekko-connectors/pull/1807#discussion_r3743214184


##########
ftp/src/main/scala/org/apache/pekko/stream/connectors/ftp/impl/CommonFtpOperations.scala:
##########
@@ -108,10 +113,41 @@ private[ftp] trait CommonFtpOperations {
 }
 
 private[ftp] object CommonFtpOperations {
-  def concatPath(path: String, name: String): String =
-    if (path.endsWith("/")) {
+
+  /**
+   * Validate that a path does not contain traversal sequences (`..`).
+   * Rejects null values and paths containing `..` as a path segment.
+   *
+   * @param path      the path to validate
+   * @param fieldName the name of the field for error messages
+   * @throws IllegalArgumentException if the path contains traversal sequences
+   */
+  def validatePath(path: String, fieldName: String): Unit = {
+    require(path != null, s"$fieldName must not be null")
+    val segments = path.split('/')

Review Comment:
   @He-Pin could you re-review this change when you get a chance?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to