Copilot commented on code in PR #8073:
URL: https://github.com/apache/texera/pull/8073#discussion_r3959478924
##########
notebook-migration-service/src/main/scala/org/apache/texera/service/util/JupyterKubernetesClient.scala:
##########
@@ -43,6 +43,13 @@ class JupyterKubernetesClient(client:
io.fabric8.kubernetes.client.KubernetesCli
def generatePodURI(uid: Int): String =
s"${generatePodName(uid)}.${KubernetesConfig.jupyterServiceName}.$namespace.svc.cluster.local:${KubernetesConfig.jupyterPortNumber}"
+ /**
+ * Path a user's Jupyter serves under. The uid is in the path because the
browser cannot
+ * present Texera credentials on the requests Jupyter's own scripts make,
so the gateway
+ * has to read the owner out of the URL instead.
+ */
+ def basePathFor(uid: Int): String =
s"${KubernetesConfig.jupyterBaseUrl.stripSuffix("/")}/$uid"
+
Review Comment:
`basePathFor` doesn’t normalize a missing leading “/”. If
`KUBERNETES_JUPYTER_BASE_URL` is set to something like `jupyter` (no leading
slash), `internalUrl` becomes `http://<authority>jupyter/7` (missing path
separator) and the pod’s `JUPYTER_BASE_URL` won’t be an absolute path.
Normalize the base URL similarly to `jupyterPathRegex` (strip leading/trailing
slashes, then prefix with exactly one `/`) before appending `/$uid`.
--
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]