You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@texera.apache.org by "madisonmlin (via GitHub)" <gi...@apache.org> on 2025/08/07 05:08:15 UTC
Re: [PR] feat: switch single-file dataset downloads to use browser native downloads [texera]
madisonmlin commented on code in PR #3621:
URL: https://github.com/apache/texera/pull/3621#discussion_r2259062660
##########
core/file-service/src/main/scala/edu/uci/ics/texera/service/resource/DatasetResource.scala:
##########
@@ -1200,34 +1225,84 @@ class DatasetResource {
commitHash: String,
uid: Integer
): Response = {
+ resolveDatasetAndPath(encodedUrl, datasetName, commitHash, uid) match {
+ case Left(errorResponse) =>
+ errorResponse
+
+ case Right((resolvedDatasetName, resolvedCommitHash, resolvedFilePath)) =>
+ val url = LakeFSStorageClient.getFilePresignedUrl(
+ resolvedDatasetName,
+ resolvedCommitHash,
+ resolvedFilePath
+ )
+
+ Response.ok(Map("presignedUrl" -> url)).build()
+ }
+ }
+
+ private def generatePresignedResponseWithS3(
+ encodedUrl: String,
+ datasetName: String,
+ commitHash: String,
+ uid: Integer
+ ): Response = {
+ resolveDatasetAndPath(encodedUrl, datasetName, commitHash, uid) match {
+ case Left(errorResponse) =>
+ errorResponse
+
+ case Right((resolvedDatasetName, resolvedCommitHash, resolvedFilePath)) =>
+ val fileName = resolvedFilePath.split("/").lastOption.getOrElse("download")
+ val contentType = "application/octet-stream"
+ val EXPIRATION_MINUTES = 5
Review Comment:
I've moved it to the DatasetResource class scope.
--
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: commits-unsubscribe@texera.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org