Co-authored-by: M57 <hy4ri@users.noreply.github.com>
This commit is contained in:
1 parent
7232395387
commit
50a0f30d8f
4 files changed
+70
-8
No files matched your search
@@ -2867,7 +2867,7 @@ class ChatViewModel(
|
||||
items
|
||||
.mapNotNull { item ->
|
||||
val url =
|
||||
GatewayFileClient.buildDownloadUrl(
|
||||
GatewayFileClient.buildMediaUrl(
|
||||
baseUrl,
|
||||
token,
|
||||
item.path,
|
||||
@@ -2985,7 +2985,8 @@ class ChatViewModel(
|
||||
.toSet()
|
||||
val newAttachments =
|
||||
items.mapNotNull { item ->
|
||||
val url = GatewayFileClient.buildDownloadUrl(baseUrl, "", item.path) ?: return@mapNotNull null
|
||||
val token = AuthManager.getToken().orEmpty()
|
||||
val url = GatewayFileClient.buildMediaUrl(baseUrl, token, item.path) ?: return@mapNotNull null
|
||||
if (url in existingUrls) return@mapNotNull null
|
||||
Attachment(
|
||||
uri = url,
|
||||
|
||||
@@ -1062,8 +1062,8 @@ private fun resolveImageUrl(uri: String): String {
|
||||
}
|
||||
val baseUrl = runCatching { AuthManager.getBaseUrl() }.getOrDefault("")
|
||||
val token = runCatching { AuthManager.getToken() }.getOrNull().orEmpty()
|
||||
val downloadUrl = GatewayFileClient.buildDownloadUrl(baseUrl, token, trimmed)
|
||||
if (downloadUrl != null) return downloadUrl
|
||||
val mediaUrl = GatewayFileClient.buildMediaUrl(baseUrl, token, trimmed)
|
||||
if (mediaUrl != null) return mediaUrl
|
||||
|
||||
if (baseUrl.isNotBlank() && (trimmed.startsWith("/api/") || trimmed.startsWith("api/"))) {
|
||||
val cleanPath = if (trimmed.startsWith("/")) trimmed else "/$trimmed"
|
||||
|
||||
Reference in new issue
Block a user